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

   ## Summary
   
   `KubernetesPodOperator(do_xcom_push=True, multiple_outputs=True, 
deferrable=True)` silently failed to fan out the sidecar's `return.json` dict 
into per-key XComs — only `return_value` was published. Downstream tasks 
subscripting a key got `None` at runtime with no error.
   
   Root cause: `trigger_reentry` pushed `return_value` manually inside a 
`finally` block and never returned the value to the task runner, so the 
runner's `_push_xcom_if_needed` (the code that honors `multiple_outputs` and 
fans the dict out) was bypassed.
   
   The sync path's `execute_sync` already returns `result` (`pod.py:760`). This 
aligns the deferrable path with the same contract.
   
   ## Behaviour change
   
   - **Success path** (new): `trigger_reentry` returns `xcom_sidecar_output`. 
The task runner pushes `return_value` and, when `multiple_outputs=True`, also 
fans the dict out into per-key XComs.
   - **Failure path** (preserved): the manual `xcom_push(XCOM_RETURN_KEY, ...)` 
moves into the `event["status"] != "success"` branch, above the `raise`. 
Partial sidecar output is still surfaced in XCom, and the push now happens even 
when `_clean` subsequently raises (strict improvement — previously the 
in-`finally` push was unreachable in that case).
   
   ## Closes
   
   Fixes #67224
   
   ## Tests
   
   Updated `test_async_kpo_wait_termination_before_cleanup_on_success` and 
`test_async_kpo_wait_termination_before_cleanup_on_failure` to reflect the new 
contract.
   
   Added 
`test_async_trigger_reentry_returns_sidecar_output_for_multiple_outputs` to 
lock in the success-path return value with `multiple_outputs=True`.
   
   The end-to-end `_push_xcom_if_needed` fan-out behavior is already covered by 
task-SDK unit tests.
   


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

Reply via email to