Repository navigation
Add GET /triggers to list every trigger of every kind and its status - #76260
Merged
Merged
Conversation
seanghaeli
force-pushed
the
ghaeli/to7-triggers-api
branch
2 times, most recently
from
November 2, 2026 08:06
5220260 to
51f219a
Compare
seanghaeli
marked this pull request as ready for review
November 2, 2026 08:10
seanghaeli
requested review from
XD-DENG,
ashb,
bbovenzi,
bugraoz93,
choo121600,
dheerajturaga,
ephraimbuddy,
guan404ming,
henry3260,
jason810496,
pierrejeambrun,
potiuk,
rawwar,
ryanahamilton,
shubhamraj-git,
vatsrahul1001 and
vincbeck
as code owners
November 2, 2026 08:10
Contributor
Author
|
Tagging @fat-catTW and @potiuk since this follows #76101 which you reviewed |
o-nikolas
reviewed
Nov 2, 2026
seanghaeli
requested review from
amoghrajesh,
gopidesupavan and
jscheffl
as code owners
November 3, 2026 00:35
There is no way to see what runs on the triggerers. Airflow 3 dropped the Browse > Triggers page, GET /assets shows a watcher's name and trigger id and nothing else, so a watcher failing for days looks healthy, and a failing deferred task's or callback's trigger only shows in that one owner's view. One collection, filtered by kind, status, triggerer, Dag, asset or team, answers what is failing, since when and why, the same way for every kind. Kind and status are worked out from the trigger's row, its owner and its triggerer's heartbeat, not stored: a trigger is failing from its first failure until it recovers. Sorting by failures or times puts a trigger that never failed or fired in the same place on every database. A trigger is shown to whoever can see its owner, with no new permission; team access comes with that check, so the team filter only narrows the list. Kwargs are never returned, and a trigger shared by several assets lists only the watchers on assets the caller can read. An asset's watchers carry their status in GET /assets.
…ge was read GET /triggers read a trigger's task instance and its public map index in two statements; a Dag or run deleted between them made the map index lookup raise KeyError, a 500. Such a trigger is now left out, like one whose owner let go.
… run read A trigger was shown to whoever could read its Dag, but a task trigger shows its task instance's state and try and the trigger's last error, which the task instance routes need Task Instance read for, and a callback trigger shows what the deadlines of a Dag run need Dag Run read for. Each kind is now gated like the routes that show its owner; an asset watcher's trigger still needs asset read. A caller who can read none of them gets a 403, and the permission tables list that instead of no permission.
Comparing Trigger.kind_expression() in each branch of the permission filter made Postgres evaluate its CASE and watcher subquery once per branch for every row. Testing the owner keys directly applies the same rule without it, so unfiltered pages are back to their previous speed with many triggers.
o-nikolas
approved these changes
Nov 3, 2026
seanghaeli
force-pushed
the
ghaeli/to7-triggers-api
branch
from
November 3, 2026 21:20
17cf2a1 to
38bfc3c
Compare
bbovenzi
reviewed
Nov 4, 2026
bbovenzi
approved these changes
Nov 4, 2026
1 task done
This was referenced Nov 5, 2026
hussein-awala
added a commit
to hussein-awala/airflow
that referenced
this pull request
Nov 7, 2026
apache#76260 turned the sqlalchemy import in trigger.py into a list that already has and_, so take its version.
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.
There's no way to see what runs on the triggerers:
GET /assetsshows only a watcher's name and trigger id, so a failing watcher's status has no visibility. #76101 records each trigger's failures and owner on its row; this reads them.GET /api/v2/triggersandGET /api/v2/triggers/{trigger_id}list every trigger the caller can see, with itskind,status, triggerer, failures, last error, last event and owner. Kwargs, which can hold credentials, are never loaded or returned.statusis worked out when read:pendingif no triggerer has it,orphanedif its triggerer stopped heartbeating,failingwhile it has failures since it last recovered, otherwiserunning.kind,status,triggerer_hostname,dag_id,asset_idandteams.GET /assetsgainstatus.How to review:
get_triggersand_build_responseinroutes/public/triggers.py, then the access rulePermittedTriggerFilterincore_api/security.pyand the status inTrigger.status/status_expressioninmodels/trigger.py.There is ~600 lines of source, the rest is generated code, docs and tests.
Breeze on Postgres, every kind of trigger running with one watcher crash-looping, then FAB users with one role each:
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines