yunhobb opened a new issue, #64295:
URL: https://github.com/apache/airflow/issues/64295

   ### Apache Airflow version
   
   main (development)
   
   ### What happened and how to reproduce it?
   
     **Issue Description**
   
     In `RuntimeTaskInstance.xcom_pull()`, when `map_indexes` is not specified 
(default NOTSET path), the code always appends `None` instead of user-provided 
`default` value when no XCom is found.
   
     Location: `task-sdk/src/airflow/sdk/execution_time/task_runner.py` L420
     - Current: `xcoms.append(None)`
     - Expected: `xcoms.append(default)`
   
     The explicit `map_indexes` branch (L419-426) handles `default` correctly.
   
     **Steps to reproduce:**
   
     ```python
     result = ti.xcom_pull(
         task_ids="some_task",
         key="some_key",
         default="fallback",
     )
     # Expected: "fallback"
     # Actual: None
   
   ### What you think should happen instead?
   
     xcom_pull() should return user-provided default value when no XCom is 
found, as described in the docstring:
   
     ▎ "default (None if not specified) is returned if no matching XComs are 
found."
   
     This also affects PlainXComArg.resolve() which passes default=NOTSET. Due 
to this bug, None is returned instead of NOTSET, so XComNotFound is never 
raised for custom XCom keys.
   
   ### Operating System
   
   N/A (code-level bug)
   
   ### Versions of Apache Airflow Providers
   
   N/A
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   N/A
   
   ### Anything else?
   
   This bug happens every time xcom_pull() is called without explicit 
map_indexes and no matching XCom exists. Already have a fix ready with tests.
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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