fix: avoid readiness timeout during active turns - #8
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1cd21add8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| !this.waitingForAction && | ||
| this.pendingPermissionRequestId === null && |
There was a problem hiding this comment.
Restore timeout for unresolved permission waits
When Claude is waiting on a permission prompt and more normal input is queued, this new predicate suppresses the readiness timer because waitingForAction/pendingPermissionRequestId are set. In non-stream-json mode (or any unattended client that never sends a permission control_response), stdin can already be closed with queued prompts remaining, so there is no later wakeup and the session hangs indefinitely instead of hitting the existing 30s guard whose error message explicitly covers permission prompts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Narrows the readiness timeout so it only fires during startup/no-safe-ready scenarios with queued normal work, preventing false timeouts when Claude is legitimately busy, dispatching, waiting for permission, or being interrupted.
Changes:
- Extract
shouldArmReadinessTimer()predicate that also checksturnActive,promptDispatchInFlight,waitingForAction,pendingPermissionRequestId, andinterruptInFlight. - Use the new predicate in both
waitForSessionOpChange()and the timer callback. - Add regression tests for queued prompts and queued
set_modelslash commands during a long-running turn.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/session.ts | Replace inline readiness-timer conditions with a narrowed shouldArmReadinessTimer() predicate. |
| src/session.test.ts | Add regression tests for queued prompt and queued set_model during an active turn. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d1cd21a to
ca78eaf
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: avoid readiness timeout during active turns
Summary
Validation