Repository navigation
[airflow-ctl/v0-1-test] airflow-ctl-tests: wait for Dag run terminal state before xcom commands (#67065) - #75752
Merged
shahar1 merged 1 commit intoOct 27, 2026
Conversation
…state before xcom commands (apache#67065) The airflowctl xcom integration tests are flaky on ARM CI: xcom add plus xcom get and xcom list succeed, then xcom edit and xcom delete fail with "The XCom with key ... doesn't exist". Same SHA passes on some ARM runs and fails on others. Root cause is a race between the test's xcom add and execution of runme_0. When the task transitions to RUNNING, the execution API queries every XCom key for that task instance and tells the worker to clear them via xcom_keys_to_clear (see airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py and task-sdk/src/airflow/sdk/execution_time/task_runner.py). If the xcom add lands before the task starts running -- which only takes a few seconds for the bash echo task in example_bash_operator -- the user-added XCom is wiped right before xcom edit / xcom delete fires. Wait for the targeted Dag run to reach a terminal state before each xcom command. Once the task is terminal it won't run again, so the clear logic doesn't fire and the user-added XCom survives the rest of the xcom commands. (cherry picked from commit 977935d)
Andrushika
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jason810496 and
potiuk
as code owners
October 27, 2026 12:01
This was referenced Oct 27, 2026
shahar1
approved these changes
Oct 27, 2026
shahar1
pushed a commit
that referenced
this pull request
Nov 19, 2026
…state before xcom commands (#67065) (#75752) The airflowctl xcom integration tests are flaky on ARM CI: xcom add plus xcom get and xcom list succeed, then xcom edit and xcom delete fail with "The XCom with key ... doesn't exist". Same SHA passes on some ARM runs and fails on others. Root cause is a race between the test's xcom add and execution of runme_0. When the task transitions to RUNNING, the execution API queries every XCom key for that task instance and tells the worker to clear them via xcom_keys_to_clear (see airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py and task-sdk/src/airflow/sdk/execution_time/task_runner.py). If the xcom add lands before the task starts running -- which only takes a few seconds for the bash echo task in example_bash_operator -- the user-added XCom is wiped right before xcom edit / xcom delete fires. Wait for the targeted Dag run to reach a terminal state before each xcom command. Once the task is terminal it won't run again, so the clear logic doesn't fire and the user-added XCom survives the rest of the xcom commands. (cherry picked from commit 977935d) Co-authored-by: Jarek Potiuk <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The airflowctl integration tests add an XCom right after
dags trigger. When the task starts, the execution API clears all XComs of that task instance. If the task starts after the test adds the XCom, the nextxcom editorxcom deletefails with "XCom doesn't exist". #67065 fixed this on main, butairflow-ctl/v0-1-testdoes not have the fix. I saw these steps fail in my runs for #57826.What
Clean cherry-pick of #67065. The tests now wait for the Dag run to reach a terminal state before the xcom commands. #72260 builds on this change, and I will backport it after this one.
related: #57826
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines