Repository navigation
Conversation
…hatboxai#3958, chatboxai#3959) chatboxai#3958 — run_command never returns when the command leaves a daemon child that inherits the tool's stdio pipes (Node 'close' never fires, so the awaited IPC never resolves and the session lock stays engaged): - settle the tool call on the shell's 'exit' after a bounded, re-armable drain grace, instead of waiting only for 'close' - resolve cancellation immediately as cancelled:true (Stop is terminal) - arm the same drain from the timeout path chatboxai#3959 — Stop can fail silently and permanently lock the session: - Message.handleStop no longer fails silently: bounded wait + user-facing toast - generationStopOperations: watchdog that drops a wedged stop so later Stop/Retry are not queued behind a dead task - generation-cancellation: cap how long a previous stop may hold the per-session chain - useGenerationStop: on watchdog, clear the stuck generation runtime so the lock releases - menu: add Reload (Ctrl+R) to the production View menu as a recovery path
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3958
Fixes #3959
Two related Work-mode / Stop lockups, both reproduced on 1.23.5 (Windows).
#3958 —
run_commandnever returns when the command leaves a long-running childRoot cause: the exec promise is settled only in
child.on('close'), and Node emitscloseonly after all stdio streams are closed. A daemon-style grandchild that inherited the tool's pipes keeps them open, soclosenever fires; the awaited IPC never resolves and the session lock stays engaged (Stopcan no longer reach the tool call).Changes (
src/main/skills/user-exec-runner.ts):exitafter a bounded, re-armable drain grace (2s; reset while output is still flowing), instead of waiting only forclose;cancelled: true, so Stop is terminal even with a leaked child;finishlog);user-exec-runner.windows.test.tsthat spawns a child outliving the wrapper (ping -n 8).#3959 — Stop can fail silently and lock the session forever
Root cause:
Message.handleStop()swallowed failures (catch { return false }), every retry entry point silently aborted on thatfalse; a single stop that never settled was de-duplicated (startGenerationStop) and serialized (serializeSessionStop) forever; and the "can I retry?" gate is derived from an in-memory generation runtime that can stay stuck instoppingwith no watchdog.Changes:
src/renderer/components/chat/Message.tsx: bound the stop wait (15s) and surface a toast on failure/timeout instead of a dead button;src/renderer/stores/generationStopOperations.ts: a watchdog drops a wedged stop so later Stop/Retry are not queued behind a dead task;src/renderer/stores/session/generation-cancellation.ts: cap how long a previous stop may hold the per-session chain;src/renderer/hooks/useGenerationStop.ts: on watchdog, clear the stuck generation runtime so the lock releases;src/main/menu.ts: addReload(Ctrl+R) to the production View menu as a recovery affordance.Testing
tsc --noEmit: cleanpnpm run build: OKattachment-ownership.test.tsare pre-existing and reproduce on a clean tree — unrelated to this change).Not included
The Windows Job Object (
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE) hardening suggested in #3958 is not implemented here (it would need native support). This PR fixes the hang and the session lock; a daemon that already left the process tree is still not force-killed bytaskkill /T.