Commit Graph
1 Commits
Author SHA1 Message Date
qingnian108 39f5427420 agent-console 1.3.4: Stop ends the turn at once on ACP, Claude and Codex (#768)
Stop now ends the turn at once, and a resend right after it is safe, on
all three paths:
- ACP (Devin, Cursor, Copilot, OpenCode, Pi, dsh): session/cancel goes as
  a notification, the local turn ends at once, and a resend waits for the
  cancel and the previous prompt to settle.
- Claude: the result FIFO (turnGen, awaitingResult, skipResultGens) lives
  on each CLI process, and a replaced CLI's leftover stdout is ignored.
  After a crash the queue stays open, so the next send resumes with
  --resume.
- Codex: a turn whose turn/start response arrives after Stop is
  interrupted by its own response id.

Run at 0cf12a96 on mote with HOME=$(mktemp -d):
- root bun test: 6171 pass, 0 fail;
- bun scripts/check.mjs agent-console: ok;
- in packages/agent-console: npm ci, npm run check (tsc) and npm run
  build are ok, daemon/dist is byte-identical to the committed one, and
  verify:build is OK;
- npx vitest run: 68 files, 507 passed, 17 skipped.

Broken by hand, then acp-interrupt, claude-cli and codex-interrupt were
run again. Each mutant was red:
- codex: wasCancelled forced false: 1 fail;
- codex: interrupt() no longer ends the local turn: 5 fail;
- acp: pendingCancelSettle not awaited: 1 fail;
- acp: the late prompt settle ends the turn without the activeTurnId
  guard: 1 fail;
- claude: a replaced CLI's stdout no longer ignored: 1 fail;
- claude: interrupt no longer marks its gen in skipResultGens: 2 fail;
- claude: a crash closes the queue instead of setting needsRestart: 2 fail.

Not tried: a real Claude or Codex CLI. The PR says Devin 3000.11.3 was
tried live.
Not blocking: a Codex turn/start response that arrives after
turn/completed sends an extra turn/interrupt and leaves one
staleCodexTurns entry.
2026-11-06 13:49:42 +08:00