Give `test_custom_answer_reaches_model_through_inline_picker` the 10 s hang guard its sibling tests use, fixing a CI flake
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
tests/clai2/test_ask_user_menu.py::test_custom_answer_reaches_model_through_inline_picker[\r] failed its 5 s anyio.fail_after (5.47 s) in merge-queue run 41554918326, which removed #12252, a SKILL.md-only PR, from the queue.
The guard wraps the whole Agent.run, and the run hadn't hung. The traceback shows the run task had already finished with AgentRunResult(output='done') when the deadline cancelled the wait. The runner was slow: in the same job, test_declining_reaches_the_model_through_the_plugin, an agent run with no terminal at all, took 3.64 s. The picker can't miss a key: PromptKeys.start() reads the whole pipe before the menu worker starts, and the worker polls a Queue.
The guard now allows 10 s, the same as the file's other two hang guards. The assertions are unchanged.
Verification
tests/clai2/test_ask_user_menu.pypasses locally, run serially.- The
[\r]node passed 5 of 5 serial runs.
New public surface
None.
What changes for existing users
Nothing; this only changes a test.
PR decisions
2026-11-03 · widen the hang guard to 10 s, not restructure the test · iter -
- Decision: Raise the test's anyio.fail_after from 5 to 10, the deadline this file's other two hang guards use; assertions unchanged
- Why: The guard wraps the whole Agent.run; the failing run had already completed (task result AgentRunResult(output='done')) at 5.47 s, and test_declining_reaches_the_model_through_the_plugin, an agent run with no terminal, took 3.64 s in the same job. Keys are queued before the picker reads them, so no wakeup can be missed
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/41554918326/job/125651475493
- Session: 83631298-f18b-4f97-bb7b-06200e7dbe70
2026-11-03 · no known-flakes entry for the widened guard · iter -
- Decision: Do not add the test to the check-ci-runs known-flakes list
- Why: With fail_after(10) it has the same hang guard as the file's other two, neither of which is listed; listing it would hide a real hang
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/41554918326/job/125651475493
- Session: 83631298-f18b-4f97-bb7b-06200e7dbe70
2026-11-03 · pre-push review 1 of 3 at a110b33e5742905880ea54ff990455d4b351b6d0 · iter -
- Decision: reserved: dispatching fresh reviewer
- Why: tree 51ffa5ae77e9027b8b39b7d6503062b71798aa1f; scope a56a6d6f138d1e3a9c45a9697ea513bef47a6cea..a110b33e5742905880ea54ff990455d4b351b6d0 (full branch)
- Source: https://github.com/pydantic/pydantic-ai/tree/clai2-ask-user-menu-flake
- Session: 83631298-f18b-4f97-bb7b-06200e7dbe70
2026-11-03 · pre-push review 1 of 3 at a110b33e5742905880ea54ff990455d4b351b6d0 · iter -
- Decision: no findings
- Why: tree 51ffa5ae77e9027b8b39b7d6503062b71798aa1f reviewed; scope a56a6d6f138d1e3a9c45a9697ea513bef47a6cea..a110b33e5742905880ea54ff990455d4b351b6d0 (full branch)
- Source: https://github.com/pydantic/pydantic-ai/tree/clai2-ask-user-menu-flake
- Session: 83631298-f18b-4f97-bb7b-06200e7dbe70
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.
Summary by cubic
Fixes the CI flake in test_custom_answer_reaches_model_through_inline_picker by widening its hang guard from 5 s to 10 s.
The old 5 s guard wrapped the whole Agent.run, and a loaded runner took just over 5 s to finish a run that had already completed, failing the test. The new 10 s limit matches the hang guard the file's other two tests use; assertions are unchanged.