If a v2 run got stuck while preparing or starting, web and desktop showed no Stop button. The only ways out were deleting the thread or restarting the server.
Stop now shows as soon as a run is preparing or starting, not only once it reaches "running". The server already settles a preparing or starting run on run.interrupt, and mobile already offers Stop here through the shared threadRuntimeHasInterruptibleRun check. Web now uses that same check through a small deriveCanInterruptRunningThread helper, which drives both the composer Stop button and the Escape (thread.stop) shortcut. A queued thread offers Stop only while an earlier run is still interruptible, and Stop interrupts that run, never the queued one.
This completes #13392. #14183 fixed the server half: runs that fail to start now fail instead of staying "starting". This PR redoes #13433, which was closed only because its base went stale. #14088 targeted main and was closed without merging.
Closes #13392
Testing#
Tested by hand in a dev build of this branch. I used a fake Grok CLI that forwards to the repo's ACP mock agent (apps/server/scripts/acp-mock-agent.ts), logs every message T3 Code sends, and can be switched to swallow session/new so a run hangs while starting.
Before: the run sits at "Working" while starting, and the composer only shows Send. With no Stop button, there is no way to end the run.
After: send a message while the provider hangs → Stop shows while the run is starting → Stop interrupts it → the existing Resume (play) button appears → Resume continues the run.
Full-quality video: https://files.catbox.moe/nkit00.mp4
Resume keeps the original message. The provider log for that run shows both starts were swallowed as intended. After Resume, the session/prompt the provider received contained the cut-off message ahead of the continuation:
Recording test: please remember the word KIWI-3310.
Run interrupted before provider start
Continue where you left off.
So stopping a stuck start does not lose the user's message. Resume is existing, provider-agnostic behavior that this PR does not change.
vp test run src/session-logic.test.ts src/components/chat/ComposerPrimaryActions.test.tsx: 49 passed.
tsc --noEmit for apps/web: clean.
Model: Claude Sonnet 5 and Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result:
9afa777· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.