Use `anyio.to_thread.run_sync` for CLI model resolution
Merged
KL
2mo ago+7+7+0123456789-5-5-0123456789
Related to #7112. This PR addresses CLI model resolution under Trio; it does not resolve the Agent.run() failure described in that issue.
Summary
Use anyio.to_thread.run_sync for the four CLI model-resolution paths that currently call asyncio.to_thread. Preserve prompt cancellation behavior with abandon_on_cancel=True.
Verification
- CI passed: 25 successful checks, 33 skipped checks.
- Ruff and pre-commit checks passed.
- Local collection of the plugin model-resolution test requires
pydantic_clai2, which is not installed in this checkout; CI ran the test suite.
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.