potiuk opened a new pull request, #70685: URL: https://github.com/apache/airflow/pull/70685
`handle_event_submit` decoded a task instance's stored `next_kwargs` and then assumed the result was a dict. The decode caught only four exception types, so anything the `BaseSerialization` compat fallback raised escaped; and the `isinstance` check was under `if TYPE_CHECKING:`, so it never ran at runtime. Both surface as exceptions from a function whose callers process every waiting task instance in a single pass — the scheduler's `AWAITING_INPUT` timeout sweep and two API routes — so one task instance with an unusable stored payload took the whole batch down with it. This decodes through a helper that validates its own result, and guards decode, event insertion and re-encode as one unit. A task instance whose payload cannot be processed is re-queued to fail via the existing `__fail__` path, so retries and `on_failure` callbacks run normally, rather than being left parked for the next sweep to trip over again. ### Behaviour change The HITL response endpoint and the execution API's `AWAITING_INPUT` branch previously returned HTTP 500 for such a payload; they now succeed, with the task routed to fail. No request shape that previously worked is newly rejected. ### Test plan - [x] `test_handle_event_submit_fails_task_with_unusable_next_kwargs` — parametrized over an undecodable payload and one that decodes to a non-dict - [x] `test_awaiting_input_timeout_sweep_survives_unusable_next_kwargs` — end-to-end through the sweep, with a malformed and a healthy task instance in the same batch - [x] Both fail on `main` without this change - [x] `ruff check` / `ruff format` / `mypy` clean ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Opus 5 (1M context) Generated-by: Claude Opus 5 (1M context) following the guidelines at 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]
