Skip to content

Let asset watchers write asset state over the Execution API - #76376

Merged
uranusjr merged 10 commits into
apache:mainfrom
astronomer:non-ti-writer-live-check
Nov 4, 2026
Merged

uranusjr merged 10 commits into
apache:mainfrom
astronomer:non-ti-writer-live-check

Conversation

@jedcunningham

@jedcunningham jedcunningham commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

The attempt-liveness check rejects any Execution API mutation whose token subject isn't a live task attempt or callback. Asset watchers have no task instance: the asset state store routes identify them by the null UUID (ASSET_WATCHER_ID) and record their writes as WATCHER. In-process callers skip the check, so the built-in triggerer is unaffected, but a triggerer that reaches the Execution API over HTTP (as TriggererJobRunner.make_client allows) gets a 404 on every asset state write.

This lets the watcher identity skip the check on the asset state store mutation routes. Other tokens without a live attempt are still rejected there, and the watcher identity is still rejected on routes that track attempts, such as XCom. Variable writes accept any caller since #76375. allow_asset_watcher and #76375's allow_non_ti_writer now share one mechanism: each route records which tokens may skip the check.

The existing watcher tests replaced require_auth entirely, which hid this. They now go through the real require_auth.

The attempt-liveness check rejects any mutation whose token subject is not
a live task attempt or callback. Asset watchers have no task instance: the
asset state store routes identify them by the null UUID and record their
writes as WATCHER. In-process callers skip the check, so the built-in
triggerer was unaffected, but a triggerer that reaches the Execution API
over HTTP (as TriggererJobRunner.make_client allows) got a 404 on every
asset state write.

Accept the watcher identity on the asset state store mutation routes only;
it is still rejected everywhere else. The watcher tests now go through the
real require_auth instead of replacing it, which is what hid this.
@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:task-sdk labels Nov 3, 2026

@amoghrajesh amoghrajesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one nit / race condition on merge

@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.4.0 milestone Nov 4, 2026
@vatsrahul1001 vatsrahul1001 added the backport-to-v3-4-test Backport to v3-4-test label Nov 4, 2026

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once Amogh comments are addressed.

@amoghrajesh amoghrajesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amoghrajesh handled his own comments :)

@pierrejeambrun

Copy link
Copy Markdown
Member

@amoghrajesh handled his own comments :)

Nice I was about to do the same since Jed will wake up in a bit and I believe 3.4.0rc3 is waiting for this.

allow_non_ti_writer and allow_asset_watcher now record which tokens
may skip require_auth's liveness check, instead of each adding its own
flag and condition. Routes are unchanged.
@uranusjr
uranusjr enabled auto-merge (squash) November 4, 2026 12:00
@uranusjr
uranusjr merged commit 4ef770b into apache:main Nov 4, 2026
71 of 72 checks passed
@uranusjr
uranusjr deleted the non-ti-writer-live-check branch November 4, 2026 16:20
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-4-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
❌ v3-4-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 4ef770b v3-4-test

This should apply the commit to the v3-4-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

vatsrahul1001 pushed a commit that referenced this pull request Nov 4, 2026
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
(cherry picked from commit 4ef770b)
vatsrahul1001 pushed a commit that referenced this pull request Nov 4, 2026
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
(cherry picked from commit 4ef770b)
vatsrahul1001 added a commit that referenced this pull request Nov 4, 2026
…76469)

(cherry picked from commit 4ef770b)

Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
vatsrahul1001 added a commit that referenced this pull request Nov 4, 2026
…76469)

(cherry picked from commit 4ef770b)

Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
vatsrahul1001 added a commit that referenced this pull request Nov 4, 2026
…76469)

(cherry picked from commit 4ef770b)

Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
vatsrahul1001 added a commit that referenced this pull request Nov 4, 2026
…76469)

(cherry picked from commit 4ef770b)

Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
vatsrahul1001 added a commit that referenced this pull request Nov 5, 2026
…76469)

(cherry picked from commit 4ef770b)

Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
vatsrahul1001 added a commit that referenced this pull request Nov 5, 2026
…76469)

(cherry picked from commit 4ef770b)

Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk backport-to-v3-4-test Backport to v3-4-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants