fix(app): drop the confirmation on engine toggle-off (#1598) - #1606
Merged
jeonghun-jj-lee merged 1 commit intoSep 28, 2026
Merged
Conversation
Toggling the engine off (the amicode status row) or running 'Amicode: Stop server' popped a 'there are in-flight turns. Stop anyway?' warning on essentially every stop — its only predicate was SSE stream liveness (sseState === 'live'), which is true whenever the engine is healthy, so it nagged even when fully idle. A deliberate toggle is itself the intent, and Restart (toggle-on) already has no prompt, so this also makes the two symmetric. - stop_server.ts: remove the in-flight-turns guard + its now-unused hasInFlightTurns/showWarning deps; stopServer is now stop() → deleteHandshake(), no confirmation - extension.ts: drop the hasInFlightTurns/showWarning wiring - stop_server.test.ts: assert no-confirmation contract + kill-before- delete ordering + stop() rejection does not clear the handshake Verified (subagent trace): toggle-off SIGTERM→SIGKILLs the process and frees the port (reaching the adopted/detached engine via the handshake PID), and toggle-on cold-spawns a fresh detached process — kill/respawn was already correct; only the spurious prompt needed removing. Pure extension change — no app-bundle/binary rebuild required.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 |
jeonghun-jj-lee
merged commit Sep 28, 2026
a844d55
into
feature/free-tier-fleet
11 of 12 checks passed
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.
Removes the "there are in-flight turns. Stop anyway?" prompt that popped on essentially every engine toggle-off.
Why it was broken
The guard's predicate was
sseState === "live"— but "live" is the ordinary healthy stream state (opencode emits periodic ping frames that keep it live; it only degrades to "stale" after 30s of total silence). So the warning fired even when completely idle. It was also asymmetric: toggle-off prompted, toggle-on (Restart) never did.What I verified first (subagent trace of the full chain)
The kill/respawn logic itself is correct — the prompt was the only defect:
amicode.stopServer→ServerManager.stop()sends SIGTERM, polls ≤3s, escalates to SIGKILL, then frees the port via anlsofprobe. It reaches the detached/adopted engine too (kills by the handshake-recorded PID, not just a session-spawned child). Fleet self-shutdown is an engine-side idle timer and never intercepts the signal.amicode.restartServerawaitsstop()then cold-spawns a fresh detachedopencode serve(new PID) — never adopts a stale one; stop→start is sequential, so no port-collision race.Changes
stop_server.ts— remove the in-flight-turns guard and its now-unusedhasInFlightTurns/showWarningdeps.stopServeris nowstop() → deleteHandshake(), no confirmation.extension.ts— drop thehasInFlightTurns/showWarningwiring.stop_server.test.ts— assert the no-confirmation contract, the kill-before-delete ordering, and that astop()rejection does not clear the handshake.Scope note
The Quit command (
quit_command.ts) has the identical broken predicate, but Quit closes the whole window — a more destructive action where a guard is more defensible. Left untouched here; flagging for a separate decision (remove vs. fix the predicate).Testing
stop_server3/3pnpm -r build+ window reload.