Skip to content

Fix map_index_template not rendered for sensors in reschedule mode#67867

Open
GayathriSrividya wants to merge 1 commit into
apache:mainfrom
GayathriSrividya:fix/map-index-template-reschedule-67521
Open

Fix map_index_template not rendered for sensors in reschedule mode#67867
GayathriSrividya wants to merge 1 commit into
apache:mainfrom
GayathriSrividya:fix/map-index-template-reschedule-67521

Conversation

@GayathriSrividya
Copy link
Copy Markdown
Contributor

@GayathriSrividya GayathriSrividya commented Jun 1, 2026

closes: #67521

When a sensor is configured with `map_index_template` and runs in reschedule mode, the rendered label was not being persisted to the database on each reschedule. As a result, the task instance's `rendered_map_index` column was left NULL, causing the UI to display the raw numeric `map_index` (e.g. "0", "1") instead of the human-readable rendered label.

Root cause: `TIRescheduleStatePayload` was missing the `rendered_map_index` field that all other terminal/retry state payloads have (`TIRetryStatePayload`, `TaskState`). The reschedule route handler builds a brand-new `UPDATE` query for the reschedule-specific columns (discarding the initial shared one), so the field had to be explicitly included in that new query as well.

Changes:

  • Add `rendered_map_index` to `TIRescheduleStatePayload` (server-side datamodel)
  • Update reschedule route handler to write `rendered_map_index` to the DB
  • Add Cadwyn version migration `AddRenderedMapIndexToReschedulePayload` in `v2026_06_30.py`
  • Update `_generated.py` (task-sdk client model) to include the new field
  • Pass `ti.rendered_map_index` in the `RescheduleTask` message from the task runner
  • Save `_rendered_map_index` from `RescheduleTask` in the supervisor
  • Add regression test: `test_reschedule_includes_rendered_map_index`

@GayathriSrividya GayathriSrividya force-pushed the fix/map-index-template-reschedule-67521 branch 12 times, most recently from b606b2d to 7cd80e8 Compare June 3, 2026 11:07
@kaxil
Copy link
Copy Markdown
Member

kaxil commented Jun 3, 2026

Did you check #67521 (comment) ?

Were you able to reproduce the behaviour?

Could you post screenshots and/or videos of before/after

When a sensor is rescheduled, the rendered_map_index was not being
persisted to the database. The TIRescheduleStatePayload was missing the
rendered_map_index field that all other terminal state payloads have
(retry, succeed, skip). The reschedule route handler creates a brand-new
UPDATE query for the reschedule-specific columns, discarding the initial
one — so the field had to be explicitly added to that new query as well.

Changes:
- Add rendered_map_index to TIRescheduleStatePayload server-side datamodel
- Update reschedule route handler to write rendered_map_index to the DB
- Add Cadwyn version migration AddRenderedMapIndexToReschedulePayload
- Update _generated.py (task-sdk client model) to include the field
- Pass rendered_map_index in RescheduleTask message from task runner
- Save _rendered_map_index from RescheduleTask in supervisor
- Add test for rendered_map_index in reschedule mode

closes: apache#67521
@GayathriSrividya GayathriSrividya force-pushed the fix/map-index-template-reschedule-67521 branch from 7cd80e8 to d9ef5af Compare June 3, 2026 13:20
@GayathriSrividya
Copy link
Copy Markdown
Contributor Author

Did you check #67521 (comment) ?

Were you able to reproduce the behaviour?

Could you post screenshots and/or videos of before/after

I checked that comment and re-verified the behavior.

Yes, I was able to reproduce the issue on an affected release ref:

Fresh clone at main
Checked out tag 3.1.2
Reproduced that reschedule payload/state path does not carry rendered_map_index, so mapped sensors in reschedule mode keep numeric map_index in UI.
I also re-checked current main in the same clone:

Main includes rendered_map_index in the reschedule path and does not show the same issue.
I do not have before/after UI screenshots yet from Breeze runtime in this environment. I can add them as soon as I complete a full local UI run, but the code-path and runtime payload verification above confirms the regression and fix.

If you want, I can also push a short reproduction note to the PR description with exact commands used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Airflow 3] map_index_template not rendered for sensors in reschedule mode (regression vs Airflow 2)

2 participants