manoj121999 opened a new pull request, #72184: URL: https://github.com/apache/airflow/pull/72184
Retry waits can otherwise look like scheduler or executor delays, making expected backoff and jitter difficult to distinguish from operational latency. This PR makes the retry calculation visible in Task Instance details while the current attempt is in `up_for_retry`. ### What changes - Display the next eligible retry time and final calculated delay. - Show the configured delay, exponential-backoff delay, deterministic jitter, effective maximum delay, and whether the delay was capped. - Show retry-policy context when a retry policy overrides the task configuration. - Add read-only REST API endpoints for retrieving retry details for mapped and unmapped task instances. - Return retry details only while a task instance is waiting for retry; otherwise, return `409 Conflict`. - Regenerate the OpenAPI specification, UI client, AirflowCTL models, and API permission reference. - Add backend, API, and UI tests covering task-configured retries, retry-policy overrides, capped delays, mapped task instances, permissions, and error responses. ### How it works `TaskInstance.get_retry_timing()` exposes the components of the retry calculation already used by Airflow. `next_retry_datetime()` continues to return the eligible retry time from that same calculation. The API loads the task definition from the Dag version associated with the run and calculates the details on demand. The UI requests them only for the current attempt while its state is `up_for_retry`. ### Compatibility This is an additive, visibility-only change: - It does not change retry scheduling, jitter generation, or scheduler/executor behavior. - It does not modify existing API response schemas. - It does not add a database migration, configuration option, or dependency. - It does not persist retry calculations. Historical attempts therefore do not display this breakdown. ### UI #### Before Without any details of Jitter 1st retry ended at 10:37 <img width="800" height="458" alt="image" src="https://github.com/user-attachments/assets/eb956739-e962-4548-9b98-210907de09f7" /> 2nd retry started at 10:42 <img width="699" height="486" alt="image" src="https://github.com/user-attachments/assets/8a2480d8-a9ab-4e8a-9f1a-d3007c55fcb2" /> <img width="515" height="147" alt="image" src="https://github.com/user-attachments/assets/24f18279-7253-468a-944d-5b6ca16a6222" /> #### After With jitter detials added. <img width="515" height="147" alt="image" src="https://github.com/user-attachments/assets/000e9042-e821-4564-89ef-ebf12655f9f5" /> <img width="1475" height="445" alt="image" src="https://github.com/user-attachments/assets/66d6ef34-0a0b-4d97-8075-1fcaa4a19de0" /> ### Testing - Airflow commit and manual `prek` checks, including mypy, Ruff, API generation, and the production UI build. - Backend/API tests: `breeze run pytest airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py airflow-core/tests/unit/models/test_taskinstance.py -xvs` - UI tests: `corepack pnpm vitest run src/pages/TaskInstance/Details.test.tsx src/pages/TaskInstance/RetryDetails.test.tsx` --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — OpenAI Codex (GPT-5) Generated-by: OpenAI Codex (GPT-5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged. * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. * When adding a dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). * For significant user-facing changes, create a newsfragment in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). --- Drafted-by: OpenAI Codex (GPT-5); reviewed by @manoj121999 before posting -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
