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:
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?
Code of Conduct
Apache Airflow version
main (development)
What happened and how to reproduce it?
Issue Description
In
RuntimeTaskInstance.xcom_pull(), whenmap_indexesis not specified (default NOTSET path), the code always appendsNoneinstead of user-provideddefaultvalue when no XCom is found.Location:
task-sdk/src/airflow/sdk/execution_time/task_runner.pyL420xcoms.append(None)xcoms.append(default)The explicit
map_indexesbranch (L419-426) handlesdefaultcorrectly.Steps to reproduce:
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?
Code of Conduct