Skip to content

fix: add sniffio runtime dependency (stable/10 backport of #376) - #380

Merged
jwulf merged 2 commits into
stable/10from
feat/issue-377
Nov 12, 2026
Merged

jwulf merged 2 commits into
stable/10from
feat/issue-377

Conversation

@jwulf

@jwulf jwulf commented Nov 11, 2026

Copy link
Copy Markdown
Member

Closes #377

Backport of #376 to stable/10. The fix is not yet on main, so it is implemented directly here.

  • Adds sniffio>=1.3.0 to [project].dependencies (and uv.lock). Without it, httpcore 1.0.9 retries import sniffio on 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.
  • Guard test tests/acceptance/test_runtime_dependencies.py: checks that sniffio is declared in pyproject.toml and that importlib.util.find_spec("sniffio") is not None. Red before the dependency change, green after.
  • Docs: the issue scopes the connection-pool guidance as conditional on it landing on main first. It hasn't, so there's nothing to backport.

No generator or generated/ changes.

Checks run locally: ruff check and ty check pass (the pre-push hook also passed), and the new test passes. The full acceptance suite and make generate could not finish in this agent's environment (they hung), so CI is the gate for those.

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>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 23:46
@jwulf

jwulf commented Nov 11, 2026

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.0 and locks version 1.3.1.
  • Adds acceptance tests checking that sniffio is 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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the sniffio runtime-dependency backport.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@jwulf
jwulf merged commit bee1189 into stable/10 Nov 12, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants