Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): Stop works while a run is still starting #14201

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 2 commits intot3code/codex-turn-mapping fromrefs/pull/14201/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

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.

Before: stuck run, no Stop button

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.

After: Stop a stuck run, then resume it

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

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—4.9 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.7 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.4 KiB—29.3 KiB✅
      CodexLive turn messages—2—8✅
      ClaudeTotal thread wire—4.9 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.7 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—20.7 KiB—29.3 KiB✅
      ClaudeLive turn messages—1—8✅

      Baseline: unavailable · PR result: 9afa777 · Source CI: success

      Scenario 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.

      • Codex decoded thread snapshot: 106.1 KiB
      • Claude decoded thread snapshot: 106.4 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 310cbfa

      Macroscope's review found this PR approvable — This is a focused web UI bug fix that exposes the existing Stop action during preparing and starting phases using the established interruptible-run state. The change is localized, pure-state driven, and covered by targeted tests without schema, deployment, security, billing, or default changes.

      No code changes detected at 9afa777. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.