Repository navigation
Add scoped Execution API access for Dag processors - #74370
Merged
ephraimbuddy merged 6 commits intoOct 14, 2026
Merged
Conversation
1 task done
ephraimbuddy
marked this pull request as ready for review
October 7, 2026 12:20
ephraimbuddy
requested review from
XD-DENG,
amoghrajesh,
ashb,
bugraoz93,
choo121600,
dheerajturaga,
henry3260,
jason810496,
jedcunningham,
jscheffl,
kaxil,
potiuk and
shahar1
as code owners
October 7, 2026 12:20
ashb
reviewed
Oct 7, 2026
ashb
reviewed
Oct 7, 2026
ashb
left a comment
Member
There was a problem hiding this comment.
(Only skimmed first 25% of PR so far)
kaxil
approved these changes
Oct 8, 2026
ephraimbuddy
force-pushed
the
dag-processor-api-foundation
branch
from
October 9, 2026 08:40
f2b0be1 to
eb40af7
Compare
Contributor
Author
|
Please don't merge until main is 3.5.0 |
ephraimbuddy
force-pushed
the
dag-processor-api-foundation
branch
from
October 12, 2026 13:41
7f41241 to
3a7e258
Compare
Dag processors need credentials tied to their registered Job and granted bundles before they can communicate with a remote Execution API. Keep this foundation independently reviewable while the processor command retains its existing database-backed behavior.
The heading warning prevents the security documentation from building successfully.
New Dags can query execution state while parsing, before they have a DagModel row. Rejecting those requests prevents their initial parse from completing.
Task and processor credentials need distinct validation so task-only routes cannot receive processor identities. Expired provisioning credentials must not leave a registered Job behind, while trusted in-process task identities must remain usable without JWT expiry.
Provisioner restarts and transient write failures must not interrupt running processors. Failed registration must not leave an incomplete Job that a retry can adopt.
Slow CI responses can exceed the best-effort renewal deadline, while the authentication guidance must reflect the scoped Execution API contract.
ephraimbuddy
force-pushed
the
dag-processor-api-foundation
branch
from
October 14, 2026 06:42
3a7e258 to
c0699b3
Compare
1 task done
1 task done
1 task done
1 task done
1 task
ashb
added a commit
that referenced
this pull request
Oct 17, 2026
* Resolve a trigger's XCom requests as its deferred task instance Note: _None_ of this is a security boundary, and should not be treated as such. The Execution API resolves XCom reads and writes for a task inside a loop to the caller's own iteration, using the task identity in the caller's JWT. Triggers have no such identity: the triggerer talks to an in-process API that treats every request as the all-zero task instance. A trigger's XCom requests therefore resolve as an anonymous caller rather than as the deferred task it runs for, so it can neither read (a 400) nor write the XComs of a task inside a loop. Triggers can also share one runner coroutine and one comms channel (the "shared streams" idea), so only the asyncio task running a trigger's code knows which trigger it is; a context variable carries that trigger's task instance id to each request frame. Shared-stream groups are started from whichever trigger subscribes first but serve several triggers, so they start with it cleared rather than inheriting that trigger's id. This isn't ideal, but will do "for now". The trigger runner process (the one running async code) sets the task instance id, and since that process runs user code a trigger can claim to be any task instance. The (in-process) API therefore checks the claim. A write acts as the task instance only when it is deferred and its trigger is already assigned to the calling triggerer. A read acts as it whenever that try is still live, because after a user marks a deferred task failed or successful the trigger row is gone and the triggerer still runs the trigger's on_kill(). The most a misbehaving trigger can do is write as another task that is deferred on the same triggerer, or read as any live task, and it can already read and write every task's XComs by coordinates through the in-process API. As stated, this is _not_ a security boundary we can rely on Requests that fail the check are rejected rather than falling back to the anonymous identity, deliberately: a trigger whose task instance is no longer deferred, or whose trigger was reassigned, should not still be writing its task's XComs, and falling back would only work for tasks outside loops. Clearing a deferred task archives its try before on_kill() runs, so on_kill() after a clear cannot read its task's XComs; a trigger that needs a job id there should keep it on the trigger, as the in-tree triggers already do. Only the in-process API that the triggerer creates knows which triggerer is calling, so every other API rejects the header rather than trusting it. A triggerer that eventually talks to a real API server will need its own credential before this can work there. Only the XCom routes honour the trigger's task instance id for now. get_previous_task_instance also resolves relative to the caller, so a trigger asking for its previous task instance still gets the latest pass rather than the one at its own loop position. Every other request from the triggerer keeps its current identity, so access rules and the live-attempt check on those routes are unchanged. * fixup! Resolve a trigger's XCom requests as its deferred task instance Pin the HEAD and DELETE rules in the trigger claim check and assert which check denied each 403, so loosening the read-method test no longer passes. * fixup! Resolve a trigger's XCom requests as its deferred task instance Ignore a trigger failure reported by a triggerer that no longer owns the trigger. The XCom write check now answers 403 to a stale copy on its previous owner, which raises before yielding and would otherwise have Trigger.submit_failure send the task to __fail__ while the new owner is still running it. (cherry picked from commit 61f1d4b) Adapted to v3-4-test's CurrentTIToken: the typed execution tokens from the Dag processor scoped access work (#74370) are not on this branch.
ashb
added a commit
that referenced
this pull request
Oct 17, 2026
…) (#74868) * Resolve a trigger's XCom requests as its deferred task instance Note: _None_ of this is a security boundary, and should not be treated as such. The Execution API resolves XCom reads and writes for a task inside a loop to the caller's own iteration, using the task identity in the caller's JWT. Triggers have no such identity: the triggerer talks to an in-process API that treats every request as the all-zero task instance. A trigger's XCom requests therefore resolve as an anonymous caller rather than as the deferred task it runs for, so it can neither read (a 400) nor write the XComs of a task inside a loop. Triggers can also share one runner coroutine and one comms channel (the "shared streams" idea), so only the asyncio task running a trigger's code knows which trigger it is; a context variable carries that trigger's task instance id to each request frame. Shared-stream groups are started from whichever trigger subscribes first but serve several triggers, so they start with it cleared rather than inheriting that trigger's id. This isn't ideal, but will do "for now". The trigger runner process (the one running async code) sets the task instance id, and since that process runs user code a trigger can claim to be any task instance. The (in-process) API therefore checks the claim. A write acts as the task instance only when it is deferred and its trigger is already assigned to the calling triggerer. A read acts as it whenever that try is still live, because after a user marks a deferred task failed or successful the trigger row is gone and the triggerer still runs the trigger's on_kill(). The most a misbehaving trigger can do is write as another task that is deferred on the same triggerer, or read as any live task, and it can already read and write every task's XComs by coordinates through the in-process API. As stated, this is _not_ a security boundary we can rely on Requests that fail the check are rejected rather than falling back to the anonymous identity, deliberately: a trigger whose task instance is no longer deferred, or whose trigger was reassigned, should not still be writing its task's XComs, and falling back would only work for tasks outside loops. Clearing a deferred task archives its try before on_kill() runs, so on_kill() after a clear cannot read its task's XComs; a trigger that needs a job id there should keep it on the trigger, as the in-tree triggers already do. Only the in-process API that the triggerer creates knows which triggerer is calling, so every other API rejects the header rather than trusting it. A triggerer that eventually talks to a real API server will need its own credential before this can work there. Only the XCom routes honour the trigger's task instance id for now. get_previous_task_instance also resolves relative to the caller, so a trigger asking for its previous task instance still gets the latest pass rather than the one at its own loop position. Every other request from the triggerer keeps its current identity, so access rules and the live-attempt check on those routes are unchanged. * fixup! Resolve a trigger's XCom requests as its deferred task instance Pin the HEAD and DELETE rules in the trigger claim check and assert which check denied each 403, so loosening the read-method test no longer passes. * fixup! Resolve a trigger's XCom requests as its deferred task instance Ignore a trigger failure reported by a triggerer that no longer owns the trigger. The XCom write check now answers 403 to a stale copy on its previous owner, which raises before yielding and would otherwise have Trigger.submit_failure send the task to __fail__ while the new owner is still running it. (cherry picked from commit 61f1d4b) Adapted to v3-4-test's CurrentTIToken: the typed execution tokens from the Dag processor scoped access work (#74370) are not on this branch.
vatsrahul1001
pushed a commit
that referenced
this pull request
Oct 20, 2026
…) (#74868) * Resolve a trigger's XCom requests as its deferred task instance Note: _None_ of this is a security boundary, and should not be treated as such. The Execution API resolves XCom reads and writes for a task inside a loop to the caller's own iteration, using the task identity in the caller's JWT. Triggers have no such identity: the triggerer talks to an in-process API that treats every request as the all-zero task instance. A trigger's XCom requests therefore resolve as an anonymous caller rather than as the deferred task it runs for, so it can neither read (a 400) nor write the XComs of a task inside a loop. Triggers can also share one runner coroutine and one comms channel (the "shared streams" idea), so only the asyncio task running a trigger's code knows which trigger it is; a context variable carries that trigger's task instance id to each request frame. Shared-stream groups are started from whichever trigger subscribes first but serve several triggers, so they start with it cleared rather than inheriting that trigger's id. This isn't ideal, but will do "for now". The trigger runner process (the one running async code) sets the task instance id, and since that process runs user code a trigger can claim to be any task instance. The (in-process) API therefore checks the claim. A write acts as the task instance only when it is deferred and its trigger is already assigned to the calling triggerer. A read acts as it whenever that try is still live, because after a user marks a deferred task failed or successful the trigger row is gone and the triggerer still runs the trigger's on_kill(). The most a misbehaving trigger can do is write as another task that is deferred on the same triggerer, or read as any live task, and it can already read and write every task's XComs by coordinates through the in-process API. As stated, this is _not_ a security boundary we can rely on Requests that fail the check are rejected rather than falling back to the anonymous identity, deliberately: a trigger whose task instance is no longer deferred, or whose trigger was reassigned, should not still be writing its task's XComs, and falling back would only work for tasks outside loops. Clearing a deferred task archives its try before on_kill() runs, so on_kill() after a clear cannot read its task's XComs; a trigger that needs a job id there should keep it on the trigger, as the in-tree triggers already do. Only the in-process API that the triggerer creates knows which triggerer is calling, so every other API rejects the header rather than trusting it. A triggerer that eventually talks to a real API server will need its own credential before this can work there. Only the XCom routes honour the trigger's task instance id for now. get_previous_task_instance also resolves relative to the caller, so a trigger asking for its previous task instance still gets the latest pass rather than the one at its own loop position. Every other request from the triggerer keeps its current identity, so access rules and the live-attempt check on those routes are unchanged. * fixup! Resolve a trigger's XCom requests as its deferred task instance Pin the HEAD and DELETE rules in the trigger claim check and assert which check denied each 403, so loosening the read-method test no longer passes. * fixup! Resolve a trigger's XCom requests as its deferred task instance Ignore a trigger failure reported by a triggerer that no longer owns the trigger. The XCom write check now answers 403 to a stale copy on its previous owner, which raises before yielding and would otherwise have Trigger.submit_failure send the task to __fail__ while the new owner is still running it. (cherry picked from commit 61f1d4b) Adapted to v3-4-test's CurrentTIToken: the typed execution tokens from the Dag processor scoped access work (#74370) are not on this branch.
1 task done
This was referenced Nov 4, 2026
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.
Give Dag processors scoped access to the Execution API without giving them the API signing key. Trusted provisioning issues a bundle-scoped session token, registration exchanges it for a Job credential, and the processor exchanges that credential for individual parsing-attempt tokens.
This PR provides Job registration, heartbeat and completion, credential renewal, bundle/team authorization, and the processor-side HTTP client. It also adds the Job identity migration and versioned API contracts.
This is the foundation for #74233, which adds the processor integration, result publication and deployment support. The normal
airflow dag-processorcommand keeps its existing behavior in this PR.Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-6) following the guidelines