Skip to content

fix(app): drop the confirmation on engine toggle-off (#1598) - #1606

Merged
jeonghun-jj-lee merged 1 commit into
feature/free-tier-fleetfrom
fix/1598-remove-stop-confirmation
Sep 28, 2026
Merged

jeonghun-jj-lee merged 1 commit into
feature/free-tier-fleetfrom
fix/1598-remove-stop-confirmation

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

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:

  • Toggle OFF fully kills the process: amicode.stopServer → ServerManager.stop() sends SIGTERM, polls ≤3s, escalates to SIGKILL, then frees the port via an lsof probe. 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.
  • Toggle ON spawns a genuinely new process: amicode.restartServer awaits stop() then cold-spawns a fresh detached opencode 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-unused hasInFlightTurns/showWarning deps. stopServer is now stop() → deleteHandshake(), no confirmation.
  • extension.ts — drop the hasInFlightTurns/showWarning wiring.
  • stop_server.test.ts — assert the no-confirmation contract, the kill-before-delete ordering, and that a stop() 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

  • 297 test files pass (5018 tests); stop_server 3/3
  • Extension typecheck clean
  • Pure extension change — no app-bundle/binary rebuild required; just a pnpm -r build + window reload.

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.
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bdab6489-02d4-4b1b-89bb-30e523e3f6c8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeonghun-jj-lee
jeonghun-jj-lee merged commit a844d55 into feature/free-tier-fleet Sep 28, 2026
11 of 12 checks passed
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.

1 participant