seanghaeli opened a new pull request, #75934:
URL: https://github.com/apache/airflow/pull/75934
Airflow 3 dropped Browse > Triggers, so there's no way to see what runs on
the triggerers.
This PR is independent of the trigger state PR (opening separately): no
migration, no `trigger` table change, and they merge in either order. A small
follow-up adds the failure fields and a `failing` status once both are in.
- `GET /api/v2/triggers` and `GET /api/v2/triggers/{trigger_id}` list every
trigger the caller can see, with its `kind`, `status`, triggerer host, `dag_id`
and owner. Kwargs are never returned.
- Kind and owner come from what refers to the trigger: its task instance,
its callback (Dag run via the deadline) or its asset watchers. Status is
`pending`, `orphaned` (triggerer stopped heartbeating) or `running`.
- Filters: `kind`, `status`, `triggerer_hostname`, `dag_id`, `asset_id`.
- No new permission: you see a trigger if you can read its Dag or one of its
watchers' assets; with multi-team, only global triggers and your teams'.
- `GET /assets` watchers gain `status`, null if you can't see the trigger. A
shared trigger lists only watchers on assets you can read; `?asset_id=` of an
unreadable asset returns nothing. UI deadlines gain `callback_trigger_id`.
How to review: the access rule is `PermittedTriggerFilter` and
`ReadableTriggerTeams` in `core_api/security.py`; the watcher rules are
`AssetResponse.from_asset_row` in `datamodels/assets.py` and the `asset_id`
guard in `routes/public/triggers.py`; kind, Dag and status are in
`common/db/triggers.py`. The rest is generated code and tests.
Breeze on Postgres, a deferred task, a deadline callback and a trigger
shared by two assets:
```text
# before: main 2c560aad523
--- GET /api/v2/triggers -> HTTP 404
{"error":"API route not found"}
--- GET /api/v2/assets watchers (name, status): [('healthy_watcher', '<no
status field>'), ('twin_b_watcher', '<no status field>'), ('twin_b_watcher',
'<no status field>')]
# after: this PR 195ad825288
--- GET /api/v2/triggers -> HTTP 200
total_entries=4
id=1 kind=asset_watcher status=running host=trig-a dag_id=None |
watchers to_twin_a_asset/twin_b_watcher,to_twin_b_asset/twin_b_watcher
id=2 kind=asset_watcher status=running host=trig-a dag_id=None |
watchers to_healthy_asset/healthy_watcher
id=4 kind=callback status=running host=trig-a
dag_id=to_kinds_deadline | callback 01a18504 dag=to_kinds_deadline
run=manual__2026-10-29T00:17:08.505833+00:00 cb_state=running
id=3 kind=task status=running host=trig-a
dag_id=to_kinds_tasks | task to_kinds_tasks.wait_long try=1 ti_state=deferred
?kind=callback -> HTTP 200 ids=[4]
?kind=asset_watcher -> HTTP 200 ids=[1 2]
?triggerer_hostname=trig-a -> HTTP 200 ids=[1 2 3 4]
?dag_id=to_kinds_tasks -> HTTP 200 ids=[3]
?dag_id=to_kinds_deadline -> HTTP 200 ids=[4]
?asset_id=2 -> HTTP 200 ids=[1]
?asset_id=3 -> HTTP 200 ids=[2]
?order_by=-created_date -> HTTP 200 ids=[4 3 2 1]
--- GET /api/v2/assets watchers (name, trigger_id, status):
[('healthy_watcher', 2, 'running'), ('twin_b_watcher', 1, 'running'),
('twin_b_watcher', 1, 'running')]
=== B) [00:18:29] kill -9 the triggerer (health threshold 30s), then a new
run of to_kinds_tasks
--- [00:19:28] killed at 00:18:29, now past the threshold:
total_entries=5
id=1 kind=asset_watcher status=orphaned host=trig-a dag_id=None |
watchers to_twin_a_asset/twin_b_watcher,to_twin_b_asset/twin_b_watcher
id=2 kind=asset_watcher status=orphaned host=trig-a dag_id=None |
watchers to_healthy_asset/healthy_watcher
id=4 kind=callback status=orphaned host=trig-a
dag_id=to_kinds_deadline | callback 01a18504 dag=to_kinds_deadline
run=manual__2026-10-29T00:17:08.505833+00:00 cb_state=running
id=3 kind=task status=orphaned host=trig-a
dag_id=to_kinds_tasks | task to_kinds_tasks.wait_long try=1 ti_state=deferred
id=5 kind=task status=pending host=None dag_id=to_kinds_tasks
| task to_kinds_tasks.wait_long try=1 ti_state=deferred
--- GET /api/v2/assets watchers (name, status): [('healthy_watcher',
'orphaned'), ('twin_b_watcher', 'orphaned'), ('twin_b_watcher', 'orphaned')]
# multi-team: alice in team alpha; ursula in team alpha and may read only
mt_alpha_twin_a_asset (trigger 4 is shared by twin_a and twin_b)
--- alice (token HTTP 201)
GET /triggers total_entries=4 visible=3:asset_watcher:alpha:running,
4:asset_watcher:alpha:running, 5:asset_watcher:alpha:running,
6:task:alpha:running
4 asset_watchers=['mt_alpha_twin_a_asset/alpha_twin_b_watcher',
'mt_alpha_twin_b_asset/alpha_twin_b_watcher']
GET /triggers/4 asset_watchers: ['alpha_twin_b_watcher',
'alpha_twin_b_watcher']
GET /triggers?asset_id=6 (twin_b): HTTP 200 ids=[4]
GET /assets watchers (name, status): [('alpha_creds_watcher',
'running'), ('alpha_healthy_watcher', 'running'), ('alpha_twin_b_watcher',
'running'), ('alpha_twin_b_watcher', 'running'), ('beta_creds_watcher', None),
('beta_healthy_watcher', None)]
GET /assets/{twin_a,twin_b}: 200 200
--- ursula (token HTTP 201)
GET /triggers total_entries=2 visible=4:asset_watcher:alpha:running,
6:task:alpha:running
4 asset_watchers=['mt_alpha_twin_a_asset/alpha_twin_b_watcher']
GET /triggers/4 asset_watchers: ['alpha_twin_b_watcher']
GET /triggers?asset_id=6 (twin_b): HTTP 200 ids=[]
GET /assets watchers (name, status): [('alpha_twin_b_watcher',
'running')]
GET /assets/{twin_a,twin_b}: 200 403
# FAB auth manager, one role per user: Dag to_kinds_tasks only, Dag
to_kinds_deadline only, assets only, nothing
--- u_task (token HTTP 201): list HTTP 200
total_entries=1 visible=4:task(wait_long)
--- u_deadline (token HTTP 201): list HTTP 200
total_entries=1 visible=5:callback
--- u_asset_nologs (token HTTP 201): list HTTP 200
total_entries=3 visible=1:asset_watcher(healthy_watcher),
2:asset_watcher(secret_watcher), 3:asset_watcher(creds_watcher)
--- u_nothing (token HTTP 201): list HTTP 200
total_entries=0 visible=
no token: list HTTP 401 detail HTTP 401
```
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Opus 5.5) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]