Use `anyio` for CLI sign-in I/O
Merged
KL
2mo ago+13+13+01234567890123456789-9-9-0123456789
Why we make these changes
Related to #7112. CLI sign-in still uses asyncio.to_thread for browser launches and credential I/O, and asyncio.sleep for PKCE polling. Move these operations to AnyIO as one bounded step toward Trio support.
New public surface
none
User-visible behavior
Codex, OpenRouter, and PKCE sign-in keep the same worker-thread and polling behavior. abandon_on_cancel=True preserves the existing cancellation behavior for direct thread calls. The guarded PKCE credential write keeps its existing completion guarantee. Trio tests remain for the final migration step.
Verification
- Ruff, Pyright on the three changed files, and pre-commit passed locally.
- CI passed, including CLI tests on Python 3.10 through 3.14, quality checks, and coverage. Focused tests could not collect locally because this checkout's
.venvlackstermflow.
What changes for existing users
Nothing under asyncio.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver. (Not applicable.)
- PR title is fit for the release changelog.
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.