Repository navigation
[v3-4-test] Migrate Task SDK to httpx2 (#73116) - #74891
Merged
Merged
Conversation
* Depend on httpx2 instead of httpx in the Task SDK httpx has stalled: fixes that landed in httpx2 (a fork of httpx 0.28.1) have not shipped upstream, and starlette has already migrated, so FastAPI following is a matter of time. Moving the Execution API client now keeps the SDK on a maintained HTTP stack. Objects do not cross the httpx/httpx2 boundary, so the in-process Execution API transports move with the client that consumes them; the rest of airflow-core stays on httpx and migrates separately. related: #70522 * Add newsfragment for the Task SDK httpx2 migration * Match the in-process test client transport to the installed Task SDK Compat tests pair the repo's devel-common helpers with a released Airflow whose Task SDK is still on httpx. Pinning the helper to httpx2 hands those clients a transport from the wrong package, and httpx rejects the response stream it gets back. * Rename newsfragment to the new PR number * Pin the Task SDK ast-grep hook to a frozen revision Every other third-party hook in the repo pins an immutable SHA; a mutable tag lets the hook change under CI without a diff. * Remove unneeded newsfragment * Verify Task SDK HTTP logging and simplify test helpers Both HTTP stacks can coexist while compatibility jobs use older SDK distributions. The migration needs regression coverage for its logging behavior without exposing development-only helpers as public APIs. * Use httpx2 in the Dag run note client test * Use httpx2 in the execution API shutdown tests Tests added on main for in-process shutdown still referenced httpx, which this branch no longer imports in the module. * Trust the system certificate store in the Task SDK API client httpx2 verifies against the system trust store via truststore, so keeping certifi for the Execution API client would add a direct dependency only to maintain a second, different set of trusted roots in the same worker. * Ban httpx imports in the Task SDK with ruff Ruff already enforces banned imports, so a separate ast-grep hook and its extra pre-commit dependency are unnecessary. extend-banned-api adds to the root banned-api table instead of replacing it. * Use httpx2 in the server termination acknowledgement test The test arrived on main after the Task SDK moved to httpx2 and still referenced httpx, which the module no longer imports. * Test the Task SDK SSL context against a real CA file Mocking load_verify_locations while also writing a CA file to disk tested neither path convincingly. Keeping the certificate-generation imports inside the fixture limits them to the one place that needs them. * Note when the in-process httpx resolver can be removed * Apply suggestion from @ashb Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com> * Use httpx2 in the supervisor launch error test helper The helper arrived on main after the Task SDK moved to httpx2 and still referenced httpx, which the module no longer imports. * Remove the duplicated in-process httpx resolver note * Use httpx2 in the supervisor execution timeout test The test arrived on main after the Task SDK moved to httpx2 and still referenced httpx, which the module no longer imports. * Use httpx2 in the request handler tests The tests arrived on main after the Task SDK moved to httpx2; the client rejects httpx transports. --------- (cherry picked from commit 63f5845) Co-authored-by: Zach <zach.gottesman@datadoghq.com> Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
1 task done
ashb
approved these changes
Oct 16, 2026
ashb
marked this pull request as ready for review
October 16, 2026 19:58
ashb
requested review from
amoghrajesh,
bugraoz93,
gopidesupavan,
jason810496,
jscheffl,
kaxil and
potiuk
as code owners
October 16, 2026 19:58
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.
httpx has stalled: fixes that landed in httpx2 (a fork of httpx 0.28.1)
have not shipped upstream, and starlette has already migrated, so FastAPI
following is a matter of time. Moving the Execution API client now keeps
the SDK on a maintained HTTP stack.
Objects do not cross the httpx/httpx2 boundary, so the in-process
Execution API transports move with the client that consumes them; the
rest of airflow-core stays on httpx and migrates separately.
related: #70522
Add newsfragment for the Task SDK httpx2 migration
Match the in-process test client transport to the installed Task SDK
Compat tests pair the repo's devel-common helpers with a released Airflow
whose Task SDK is still on httpx. Pinning the helper to httpx2 hands those
clients a transport from the wrong package, and httpx rejects the response
stream it gets back.
Rename newsfragment to the new PR number
Pin the Task SDK ast-grep hook to a frozen revision
Every other third-party hook in the repo pins an immutable SHA; a mutable
tag lets the hook change under CI without a diff.
Remove unneeded newsfragment
Verify Task SDK HTTP logging and simplify test helpers
Both HTTP stacks can coexist while compatibility jobs use older SDK
distributions. The migration needs regression coverage for its logging
behavior without exposing development-only helpers as public APIs.
Use httpx2 in the Dag run note client test
Use httpx2 in the execution API shutdown tests
Tests added on main for in-process shutdown still referenced httpx, which this branch no longer imports in the module.
httpx2 verifies against the system trust store via truststore, so keeping certifi for the Execution API client would add a direct dependency only to maintain a second, different set of trusted roots in the same worker.
Ruff already enforces banned imports, so a separate ast-grep hook and its extra pre-commit dependency are unnecessary. extend-banned-api adds to the root banned-api table instead of replacing it.
The test arrived on main after the Task SDK moved to httpx2 and still referenced httpx, which the module no longer imports.
Mocking load_verify_locations while also writing a CA file to disk tested neither path convincingly. Keeping the certificate-generation imports inside the fixture limits them to the one place that needs them.
Note when the in-process httpx resolver can be removed
Apply suggestion from @ashb
Co-authored-by: Ash Berlin-Taylor ash_github@firemirror.com
The helper arrived on main after the Task SDK moved to httpx2 and still referenced httpx, which the module no longer imports.
Remove the duplicated in-process httpx resolver note
Use httpx2 in the supervisor execution timeout test
The test arrived on main after the Task SDK moved to httpx2 and still referenced httpx, which the module no longer imports.
The tests arrived on main after the Task SDK moved to httpx2; the client rejects httpx transports.
(cherry picked from commit 63f5845)
Co-authored-by: Zach zach.gottesman@datadoghq.com
Co-authored-by: Ash Berlin-Taylor ash_github@firemirror.com