Add a POST /xcoms/{dag_id}/{run_id}/{task_id}/keys execution API endpoint#70223
Open
dabla wants to merge 7 commits into
Open
Add a POST /xcoms/{dag_id}/{run_id}/{task_id}/keys execution API endpoint#70223dabla wants to merge 7 commits into
POST /xcoms/{dag_id}/{run_id}/{task_id}/keys execution API endpoint#70223dabla wants to merge 7 commits into
Conversation
… XCom fetch Fetching XCom results from XComIterable (which stores per-index values as distinct keys return_value_0, return_value_1, ... under the same map_index) required one API round-trip per element. The existing GetXComSequenceSlice endpoint cannot be reused because it ranges over map_index for a single key -- the inverse structure. Add a dedicated POST route that accepts a list of keys and returns all values in one database query, preserving key order in the response. The full wiring -- comms message, client method, supervisor request handler, and route registration -- is included so the endpoint is usable end-to-end once XComIterable is updated to call it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dabla
requested review from
amoghrajesh,
ashb,
ephraimbuddy,
jedcunningham and
kaxil
as code owners
July 22, 2026 09:24
amoghrajesh
reviewed
Jul 22, 2026
amoghrajesh
left a comment
Contributor
There was a problem hiding this comment.
I haven't followed up closely with AIP 104, but I have some qns from an initial look.
dabla
force-pushed
the
feature/add-xcoms-keys-route
branch
from
July 22, 2026 14:10
5258e09 to
dbf25d5
Compare
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.
Add a
POST /xcoms/{dag_id}/{run_id}/{task_id}/keysexecution API endpoint thataccepts a list of XCom keys and returns all matching values in a single database
query. Use it in
XComIterableto reduce iteration from N round-trips to one.Motivation
XComIterable(introduced in AIP-104 Task Iteration) stores per-index resultsunder distinct keys (
return_value_0,return_value_1, …) with the samemap_index. The existingGET …/sliceendpoint cannot be reused because itranges over
map_indexfor a single key — the inverse structure. Iterating orslicing a 1000-item result previously issued 1000 separate
XCom.get_onecalls.Changes
POST /xcoms/{dag_id}/{run_id}/{task_id}/keys— accepts{"keys": [...]}, returns values in request-key order (nullfor missingkeys), filtered by
map_indexquery param (default-1)has_xcom_accesssimplified: reads the optionalkeyfromrequest.path_paramsinstead of requiring a{key}path segment, so aseparate router/dependency is no longer needed
XComKeysRequestPydantic model added to execution API data modelsGetXComByKeyscomms message,XComOperations.get_by_keysclient method,handle_get_xcom_by_keyssupervisor handler, and processor dispatch wiringXComIterable.__iter__and__getitem__slice now useGetXComByKeys— one round-trip for full iteration, deserialization kept lazy via generator
expression in
__iter__TestGetXComByKeys) and forXComIterable(
TestXComIterable)Was generative AI tooling used to co-author this PR?
Claude Sonnet 4.6 (GitHub Copilot CLI)
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.