Skip to content

[v3-4-test] Read XCom without object reconstruction during dependency evaluation (#72718) - #75117

Merged
potiuk merged 1 commit into
v3-4-testfrom
backport-a7ac937-v3-4-test
Oct 19, 2026
Merged

potiuk merged 1 commit into
v3-4-testfrom
backport-a7ac937-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor
  • Read XCom without object reconstruction during dependency evaluation

The scheduler evaluates task dependencies in-process, and two of those deps read
XCom: NotPreviouslySkippedDep reads skipmixin_key for every parent that inherits
from SkipMixin, and both it and TriggerRuleDep read past_depends_met when
wait_for_past_depends_before_skipping applies.

Both went through TaskInstance.xcom_pull -> XComModel.deserialize_value, which is
json.loads(value, cls=XComDecoder). XComDecoder's object_hook calls the Airflow
serialization module with full=True, so any nested dict carrying classname is
imported and instantiated. The values these deps actually consume are primitives:
a mapping of lists of task ids, and a boolean. Nothing here needs an object
rebuilt, so the scheduler can read these values as plain JSON.

Add XComModel.deserialize_value_primitives, a plain json.loads with no
object_hook, and LazyXComPrimitivesSelectSequence alongside it. Thread full=True
through TaskInstance.xcom_pull and pass full=False at the four dep call sites.
All three of xcom_pull's return paths are covered -- the direct one, and both
lazy-sequence ones, which is the path a mapped task instance takes. The skip
decisions of SkipMixin tasks in the same mapped task group, which
NotPreviouslySkippedDep reads with one query per pass, are decoded the same way.

NotPreviouslySkippedDep also now checks that the skipmixin payload is a mapping
before testing membership in it. It reads whatever the parent task wrote, so a
scalar there previously raised TypeError inside dependency evaluation rather than
being ignored. Because the payload is now plain JSON, a set or tuple of task ids
arrives as its serde wrapper; its items are read from the wrapper without
constructing anything, and a decision whose task ids are not a list of strings is
ignored the same way.

Task code pulling another task's return value is unchanged and still gets the
original Python object; only the dependency-evaluation reads are narrowed.

Generated-by: Claude Opus 5

  • Treat only a literal True as past-depends-met during dependency evaluation

Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

  • Ignore skip decisions with a non-string classname
    (cherry picked from commit a7ac937)

Co-authored-by: Jarek Potiuk [email protected]
Generated-by: Claude Opus 5

… evaluation (#72718)

* Read XCom without object reconstruction during dependency evaluation

The scheduler evaluates task dependencies in-process, and two of those deps read
XCom: NotPreviouslySkippedDep reads skipmixin_key for every parent that inherits
from SkipMixin, and both it and TriggerRuleDep read past_depends_met when
wait_for_past_depends_before_skipping applies.

Both went through TaskInstance.xcom_pull -> XComModel.deserialize_value, which is
json.loads(value, cls=XComDecoder). XComDecoder's object_hook calls the Airflow
serialization module with full=True, so any nested dict carrying __classname__ is
imported and instantiated. The values these deps actually consume are primitives:
a mapping of lists of task ids, and a boolean. Nothing here needs an object
rebuilt, so the scheduler can read these values as plain JSON.

Add XComModel.deserialize_value_primitives, a plain json.loads with no
object_hook, and LazyXComPrimitivesSelectSequence alongside it. Thread full=True
through TaskInstance.xcom_pull and pass full=False at the four dep call sites.
All three of xcom_pull's return paths are covered -- the direct one, and both
lazy-sequence ones, which is the path a mapped task instance takes. The skip
decisions of SkipMixin tasks in the same mapped task group, which
NotPreviouslySkippedDep reads with one query per pass, are decoded the same way.

NotPreviouslySkippedDep also now checks that the skipmixin payload is a mapping
before testing membership in it. It reads whatever the parent task wrote, so a
scalar there previously raised TypeError inside dependency evaluation rather than
being ignored. Because the payload is now plain JSON, a set or tuple of task ids
arrives as its serde wrapper; its items are read from the wrapper without
constructing anything, and a decision whose task ids are not a list of strings is
ignored the same way.

Task code pulling another task's return value is unchanged and still gets the
original Python object; only the dependency-evaluation reads are narrowed.

Generated-by: Claude Opus 5

* Treat only a literal True as past-depends-met during dependency evaluation

Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

* Ignore skip decisions with a non-string classname
(cherry picked from commit a7ac937)

Co-authored-by: Jarek Potiuk <[email protected]>
Generated-by: Claude Opus 5
@potiuk
potiuk marked this pull request as ready for review October 19, 2026 16:46
@potiuk
potiuk requested review from XD-DENG and ashb as code owners October 19, 2026 16:46
@potiuk
potiuk merged commit 22e1928 into v3-4-test Oct 19, 2026
96 of 97 checks passed
@potiuk
potiuk deleted the backport-a7ac937-v3-4-test branch October 19, 2026 16:46
@github-actions github-actions Bot added this to the Airflow 3.4.1 milestone Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.4.1 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

vatsrahul1001 pushed a commit that referenced this pull request Oct 20, 2026
… evaluation (#72718) (#75117)

* Read XCom without object reconstruction during dependency evaluation

The scheduler evaluates task dependencies in-process, and two of those deps read
XCom: NotPreviouslySkippedDep reads skipmixin_key for every parent that inherits
from SkipMixin, and both it and TriggerRuleDep read past_depends_met when
wait_for_past_depends_before_skipping applies.

Both went through TaskInstance.xcom_pull -> XComModel.deserialize_value, which is
json.loads(value, cls=XComDecoder). XComDecoder's object_hook calls the Airflow
serialization module with full=True, so any nested dict carrying __classname__ is
imported and instantiated. The values these deps actually consume are primitives:
a mapping of lists of task ids, and a boolean. Nothing here needs an object
rebuilt, so the scheduler can read these values as plain JSON.

Add XComModel.deserialize_value_primitives, a plain json.loads with no
object_hook, and LazyXComPrimitivesSelectSequence alongside it. Thread full=True
through TaskInstance.xcom_pull and pass full=False at the four dep call sites.
All three of xcom_pull's return paths are covered -- the direct one, and both
lazy-sequence ones, which is the path a mapped task instance takes. The skip
decisions of SkipMixin tasks in the same mapped task group, which
NotPreviouslySkippedDep reads with one query per pass, are decoded the same way.

NotPreviouslySkippedDep also now checks that the skipmixin payload is a mapping
before testing membership in it. It reads whatever the parent task wrote, so a
scalar there previously raised TypeError inside dependency evaluation rather than
being ignored. Because the payload is now plain JSON, a set or tuple of task ids
arrives as its serde wrapper; its items are read from the wrapper without
constructing anything, and a decision whose task ids are not a list of strings is
ignored the same way.

Task code pulling another task's return value is unchanged and still gets the
original Python object; only the dependency-evaluation reads are narrowed.

Generated-by: Claude Opus 5

* Treat only a literal True as past-depends-met during dependency evaluation

Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

* Ignore skip decisions with a non-string classname
(cherry picked from commit a7ac937)


Generated-by: Claude Opus 5

Co-authored-by: Jarek Potiuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants