Skip to content

fix(claude): interrupt turn after plan is presented in plan mode - #114

Merged
JongSikLim merged 1 commit into
mainfrom
fix/claude-plan-still-waiting
Jul 8, 2026
Merged

fix(claude): interrupt turn after plan is presented in plan mode#114
JongSikLim merged 1 commit into
mainfrom
fix/claude-plan-still-waiting

Conversation

@astyfx

@astyfx astyfx commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Plan-mode turns in the Claude provider could get stuck "in progress" after the plan was presented, leaving PlanViewer's Approve/Revise and the prompt input's stop button locked.

Changes

Fixes

  • claude-sdk-runtime: call Query.interrupt() as soon as ExitPlanMode is detected, forcing the turn to end so a result message (and the done event) is always emitted, mirroring Codex's requestPlanInterrupt().

Test Evidence

  • bun run typecheck — pass
  • bun test tests/claude-sdk-runtime.test.ts tests/claude-sdk-runtime-cwd.test.ts — 86 pass, 0 fail

Notes

Root cause: ExitPlanMode only denied subsequent tool calls without ending the turn. If the model kept calling tools or narrating instead of stopping, the SDK stream never produced a final result message, so activeTurnIdsByTask in app.store.ts never cleared.

ExitPlanMode only denied subsequent tool calls without ending the turn,
so if the model kept calling tools or narrating instead of stopping, the
SDK stream never emitted a final `result` message and the turn stayed
"in progress" forever. This left PlanViewer's Approve/Revise and the
prompt input's stop button stuck, since `activeTurnIdsByTask` never
cleared without a `done` event.

Call Query.interrupt() as soon as ExitPlanMode is detected, mirroring
Codex's requestPlanInterrupt(). interrupt() halts generation for the
current turn (without closing the session), so a `result` message still
follows and `done` fires normally.
@astyfx
astyfx requested review from JongSikLim and heath-s July 8, 2026 06:16
@JongSikLim
JongSikLim merged commit 3a0b4db into main Jul 8, 2026
3 checks passed
@JongSikLim
JongSikLim deleted the fix/claude-plan-still-waiting branch July 8, 2026 06:19
@astyfx astyfx mentioned this pull request Jul 8, 2026
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