The GitHub Actions job "Tests AMD" on airflow.git/v3-0-test has failed.
Run started by GitHub user kaxil (triggered by kaxil).

Head commit for run:
3251e68cf9c509cd08f0067a9e8adcc354dc3263 / Isaiah Iruoha 
<[email protected]>
fix map_index is null dynamic task mapping bug (#54249)

closes: #52881

When tasks within nested task groups try to access XCom values from sibling 
tasks in the same mapped parent task group instance, the system incorrectly 
uses `map_index=null` instead of the correct map index, causing XCom lookup 
failures.

<img width="1033" height="494" alt="Screenshot 2025-08-07 at 1 47 06 PM" 
src="https://github.com/user-attachments/assets/f6c1767b-a999-470d-b090-478643dcdc01";
 />

```javascript
No XCom value found; defaulting to None.: key="return_value": 
dag_id="test_dag": 
task_id="expandable_task_group.inner_task_group.alter_input": 
run_id="manual__2025-07-04T14:56:47.815002+00:00": map_index=null
```
The issue is in 
`airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py` 
in the `_get_upstream_map_indexes` function.

The logic only checks the immediate parent task group 
(upstream_task.task_group) but doesn't consider nested scenarios where tasks 
are within a regular task group that is itself within a mapped task group.

Replace the immediate parent check with a hierarchy-aware check using 
`get_closest_mapped_task_group()`. This ensures that both tasks recognize they 
share the same mapped task group ancestor and use the same map_index.

- Verified proposed solution resolves issue: #52881 when tested locally using 
`breeze start-airflow` against the latest main branch development environment.
- Added `test_nested_mapped_task_group_upstream_indexes` to verify that tasks 
in nested mapped task groups correctly resolve upstream map indexes.

(cherry picked from commit f685c61704017a256fbb4393b3f4d0e6722aa869)

Report URL: https://github.com/apache/airflow/actions/runs/16938799355

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to