SachinyadavAug20 opened a new pull request, #77147:
URL: https://github.com/apache/airflow/pull/77147

   closes: #46402
   
   ### Description
   
   When using `TriggerDagRunOperator` with a dynamically resolved 
`trigger_dag_id` (e.g. from template expressions or XCom), the operator extra 
link in the Web UI previously generated a broken link or raw template string at 
parse time because it only inspected the static `operator.trigger_dag_id` 
attribute.
   
   This PR addresses the issue following maintainer review feedback from #56973:
   1. **Airflow 3 Execution Time (`task_runner.py`):** Push `trigger_dag_id` 
alongside `trigger_run_id` in `_handle_trigger_dag_run` only *after* a 
successful trigger response. This ensures failure-mode state stays consistent 
across both XComs and prevents ghost values.
   2. **Operator Link (`trigger_dagrun.py`):** In 
`TriggerDagRunLink.get_link()`, look up `XCom.get_value(ti_key=ti_key, 
key=XCOM_DAG_ID)` using an explicit `is None` identity check, falling back to 
`operator.trigger_dag_id` and rendered fields if absent. Also push 
`XCOM_DAG_ID` in `_trigger_dag_af_2` for Airflow 2 compatibility.
   3. **Tests:** Updated `test_trigger_dagrun.py` (for AF3 and AF2) and 
`test_task_runner.py` with dynamic DAG ID assertions, preserving ordered call 
assertions (`assert_has_calls`).
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes (Antigravity)
   
   Generated-by: Antigravity following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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]

  • [PR] Fix dynamic dag_id resolu... SachinyadavAug20 (via GitHub) via commits

Reply via email to