Fix dag.test() dropping defer-time kwargs when trigger yields an event#69942
Open
seanghaeli wants to merge 3 commits into
Open
Fix dag.test() dropping defer-time kwargs when trigger yields an event#69942seanghaeli wants to merge 3 commits into
seanghaeli wants to merge 3 commits into
Conversation
When DAG.test() runs a deferred task's trigger inline and the trigger
yields an event, the kwargs passed at defer() time were discarded and
replaced with only {"event": ...}. The resume method then ran with its
default argument values.
This broke example_neptune_analytics on the deferrable path:
NeptuneCreatePrivateGraphEndpointOperator defers with
kwargs={"vpc_id": self.vpc_id} and resumes into
execute_complete(..., vpc_id=""). The lost vpc_id fell back to "" and
was pushed to XCom; the downstream delete_endpoint task built a malformed
request URI (/graphs/<id>/endpoints/) and the service rejected it with
AccessDeniedException: Unable to determine service/operation name to be
authorized.
Merge the event into the deferral's next_kwargs instead of replacing
them, mirroring the production resume path in airflow.models.trigger.
Add a regression test.
seanghaeli
force-pushed
the
fix/neptune-analytics-accessdenied
branch
from
July 16, 2026 16:31
8c75edc to
deafa2e
Compare
seanghaeli
force-pushed
the
fix/neptune-analytics-accessdenied
branch
from
July 17, 2026 01:07
e1a2b80 to
9e87b69
Compare
seanghaeli
force-pushed
the
fix/neptune-analytics-accessdenied
branch
from
July 17, 2026 01:11
9e87b69 to
2cae70e
Compare
seanghaeli
marked this pull request as ready for review
July 17, 2026 01:16
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.
In dag.test(), a deferred task loses the kwargs it passed to defer() when its trigger fires; they get discarded on resume instead of kept. This adds the trigger event onto those kwargs rather than discarding them, so the resume method still receives them.
This makes it match how the triggerer already resumes deferred tasks in normal execution:
airflow/airflow-core/src/airflow/models/trigger.py
Line 534 in 58b5a80
Fixes the neptune_analytics deferrable test.