Skip to content

fix: avoid readiness timeout during active turns - #8

Merged
dn00 merged 2 commits into
mainfrom
fix/readiness-timeout-active-turn
May 29, 2026
Merged

fix: avoid readiness timeout during active turns#8
dn00 merged 2 commits into
mainfrom
fix/readiness-timeout-active-turn

Conversation

@dn00

@dn00 dn00 commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Narrow the queued readiness timeout so ordinary queued work does not kill a legitimate long-running Claude turn.
  • Keep startup/no-safe-ready and unresolved permission waits timeout-eligible so queued stdin cannot hang forever.
  • Add regression tests for long-running turns with queued prompts and queued set_model commands.
  • Add regression coverage for queued prompts blocked by unresolved permission prompts.
  • Bump version to 0.1.10 for patch release.

Validation

  • npm test -- src/session.test.ts
  • npm test
  • npm run build
  • git diff --check
  • npm pack --dry-run

@dn00
dn00 marked this pull request as ready for review May 29, 2026 07:57
@dn00
dn00 requested a review from Copilot May 29, 2026 07:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/session.ts Outdated
Comment on lines +459 to +460
!this.waitingForAction &&
this.pendingPermissionRequestId === null &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 checks turnActive, promptDispatchInFlight, waitingForAction, pendingPermissionRequestId, and interruptInFlight.
  • Use the new predicate in both waitForSessionOpChange() and the timer callback.
  • Add regression tests for queued prompts and queued set_model slash 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.

@dn00
dn00 force-pushed the fix/readiness-timeout-active-turn branch from d1cd21a to ca78eaf Compare May 29, 2026 08:05
@dn00
dn00 requested a review from Copilot May 29, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dn00
dn00 merged commit 3eb382b into main May 29, 2026
10 checks passed
dn00 added a commit that referenced this pull request May 30, 2026
fix: avoid readiness timeout during active turns
@dn00
dn00 deleted the fix/readiness-timeout-active-turn branch May 30, 2026 20:40
@dn00
dn00 restored the fix/readiness-timeout-active-turn branch May 30, 2026 20:40
@dn00
dn00 deleted the fix/readiness-timeout-active-turn branch May 30, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants