Repository navigation
fix: add sniffio runtime dependency (stable/10 backport of #376) - #380
Merged
Merged
Conversation
httpcore retries 'import sniffio' on every lock, event and cancel-shield call when sniffio is absent (encode/httpcore#1103), costing ~17% CPU per request. Declare it explicitly and guard with an acceptance test. Backport of #376 to stable/10. Closes #377 Signed-off-by: Josh Wulf <josh@magikcraft.io>
Member
Author
|
🤖 The changes in this PR were produced by nano-agent, an autonomous agent. Commits are authored under the operator's own git identity when one is resolvable (the human running the fleet), so they can satisfy CLA/DCO requirements; this note records that the work was generated by the agent. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A leftover runtime fixture contains a banned time.sleep call that causes make lint to fail on a fresh checkout and is also copied into the generated SDK.
1 open issue
What changed in this PR
Backports the sniffio runtime dependency fix to stable/10 to avoid repeated failed imports in httpcore and reduce async-client CPU overhead, addressing #377.
Changes:
- Adds
sniffio>=1.3.0and locks version 1.3.1. - Adds acceptance tests checking that
sniffiois declared and installed. - Includes an unrelated ambient-time lint fixture in
runtime/.
| File | Description |
|---|---|
uv.lock |
Locks sniffio and updates lockfile revision and dependency markers. |
tests/acceptance/test_runtime_dependencies.py |
Guards sniffio declaration and availability. |
runtime/_ban_fixture_test_ambient_time_is_rejected_2.py |
Adds an unrelated fixture containing time.sleep(1). |
pyproject.toml |
Declares sniffio as a runtime dependency. |
Review effort: Balanced
Signed-off-by: Josh Wulf <josh@magikcraft.io>
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.

Closes #377
Backport of #376 to
stable/10. The fix is not yet onmain, so it is implemented directly here.sniffio>=1.3.0to[project].dependencies(anduv.lock). Without it, httpcore 1.0.9 retriesimport sniffioon every lock, event and cancel-shield call (fix: performance regression when sniffio not installed encode/httpcore#1103), costing ~17% CPU per request on the async client.tests/acceptance/test_runtime_dependencies.py: checks that sniffio is declared inpyproject.tomland thatimportlib.util.find_spec("sniffio")is notNone. Red before the dependency change, green after.mainfirst. It hasn't, so there's nothing to backport.No generator or
generated/changes.Checks run locally:
ruff checkandty checkpass (the pre-push hook also passed), and the new test passes. The full acceptance suite andmake generatecould not finish in this agent's environment (they hung), so CI is the gate for those.