Repository navigation
Studio: correct the anyio<4.14 pin rationale (mixed-install ImportError, not a 4.14 cancel-scope bug) - #6579
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request updates the comments in the requirements and constraints files to clarify the reasoning behind capping the anyio package version to <4.14.0. The updated comments explain that a half-resolved installation with a stale 4.13 _core/_tasks under 4.14's importers leads to an ImportError and server failures. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
The pin comments said "anyio 4.14+ breaks cancel scope on Python 3.13", but a clean anyio 4.14.0 works on 3.13 (cancel scopes, Event, and the asyncio backend import all pass). The actual failure is a half-resolved install: anyio 4.14 added TaskHandle, imported by __init__.py and _backends/_asyncio from _core/_tasks. When a stale 4.13 _core/_tasks (no TaskHandle) sits under 4.14's importers, the import raises ImportError and 500s the server. Correct the rationale; the <4.14 pin still stands as the way to keep one consistent anyio version.
…4.14 cancel-scope bug)
746f275 to
763dcd6
Compare
#6579 reworded these comments to attribute the failure to a half-resolved install and claimed a clean 4.14 is fine on 3.13. That is wrong: #6483 is a genuine anyio 4.14 + Python 3.13 regression. 4.14 added a per-task cancel scope in its asyncio backend (TaskHandle/_run_coro) that gets exited in the wrong task under starlette's collapsing task group, raising the cancel-scope RuntimeError on streaming; 4.13 has no such code and is unaffected (the reporter confirmed 4.13.0 fixes it). The TaskHandle ImportError is only the secondary macOS-arm symptom from the mlx-vs-cap version fight. Comments only.
Summary
Follow-up to #6546 / #6575. The
anyio<4.14.0pin comments attribute the failure to "anyio 4.14+ breaks cancel scope on Python 3.13". That is not what happens. This PR corrects the rationale (comments only). The pin itself stays.What actually breaks
anyio 4.14.0added a new symbol,TaskHandle, inanyio/_core/_tasks.py. Bothanyio/__init__.py(line 73) and the asyncio backendanyio/_backends/_asyncio.py(line 95) now dofrom .._core._tasks import TaskHandle.4.13.0has noTaskHandleand no such import.A clean 4.14.0 is fine, including on Python 3.13. The CI 500 (
cannot import name 'TaskHandle' from anyio._core._tasks) only happens with a half-resolved install: a stale4.13 _core/_tasks.py(noTaskHandle) sitting under 4.14's importers. That mix is produced on macOS-arm by the version fight betweenmlx-vlm/mlx-lm(which pullanyio>=4.14) and this<4.14cap.Reproduction (Python 3.13)
Clean installs, both versions:
So neither clean version is broken on 3.13. Forcing the mix reproduces the exact CI error:
Restoring 4.14.0's
_core/_tasks.pyfixes it.Why the pin still stands
Keeping anyio on one consistent
<4.14line avoids the mix. On macOS-arm the cap alone loses to mlx's>=4.14, so #6575 forces it via the uv override; Linux/Windows honor the constraint directly. (An alternative would be to allow a clean>=4.14, since clean 4.14 works - but the validated fix is the consistent<4.14.)Change
Comments only, in
constraints.txtandno-torch-runtime.txt. No version changes.