Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(orchestrator): keep stop and steer responsive #3865

ClosedPixPMusic(GitHub profile, opens in a new tab)wants to merge 6 commits intot3code/codex-turn-mapping fromrefs/pull/3865/headopened View on GitHub

Summary

  • run stop/session controls on a dedicated per-thread lane instead of queuing behind mutations
  • target the known active run directly and report when no interruptible run exists
  • keep Stop available beside steering Send and wait for Codex terminal confirmation with a bounded timeout

Validation

  • vp check
  • vp run typecheck
  • focused web/client tests (23 tests)
  • Codex adapter and replay tests (16 tests)

Addresses #3607 and is stacked on #2829.


Note

Medium Risk Changes interrupt dispatch, concurrency lanes, and Codex turn-interrupt synchronization; incorrect retry or timeout handling could mis-target runs or surface spurious errors, though behavior is heavily covered by new tests.

Overview Makes Stop and steer Send usable without waiting behind other thread mutations, and tightens interrupt behavior end-to-end when sends and stops race.

Client runtime: interruptTurn and stopSession run on a per-thread control lane separate from mutation commands. interruptThreadTurn now fails with ThreadTurnNotInterruptibleError when there is no interruptible run (instead of returning a no-op success), skips a projection fetch when the caller passes an explicit runId, and is wrapped by coordinateInterruptWithPendingStarts so a quick Stop after Send retries once after the in-flight startTurn settles.

Codex: Turn completion uses shared settleCodexTurnTerminal / registerCodexTurnTerminalWaiter so interrupt can wait for terminal confirmation (10s cap) without losing to completion-vs-interrupt races.

UI: While a turn is running and the composer has text, Stop stays visible next to steer Send; interrupt includes activeRuntime.activeRunId when known.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ccd1303f57dcfcd18ba1f947e9441b7880d5d5d2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix stop and steer responsiveness by coordinating interrupt with pending turn starts

  • Interrupt commands now run on a dedicated control concurrency lane (separate from mutation), preventing them from being blocked by queued sends.
  • Adds coordinateInterruptWithPendingStarts in threadCommands.ts: if an interrupt fails with ThreadTurnNotInterruptibleError while a start is in flight for the same thread, it waits for the start to settle and retries once.
  • The interrupt handler in CodexAdapterV2.ts now registers a terminal waiter, sends turn/interrupt, and waits up to 10 seconds for the turn to reach a terminal state before returning a protocol error on timeout.
  • Stop button in ComposerPrimaryActions.tsx is now always visible when a turn is running, even when the composer has sendable content.
  • Risk: interrupt requests that time out waiting for terminal state now return a protocol error after 10 seconds instead of completing silently.
Macroscope summarized ccd1303.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. 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: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 9f216029-5ab6-451c-85d3-41c2d473e4e0

      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
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a43c69bf4c2beb50119c7cc2577e02cc86d6f2a3. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR adds significant new concurrency coordination logic for start/interrupt race conditions, introduces new command lanes, error types, and timeout handling across multiple layers. The scope and complexity of these changes - including new control flow patterns and UI behavior changes - warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Caution

      Review failed

      An error occurred during the review process. Please try again later.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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.
    6. Closing because real end-to-end verification found a critical mismatch: after Stop, the UI reported Run interrupted by user, but the spawned sleep process remained alive until its natural timeout. #4229 now covers the containment/recovery side and passed a live Codex check where Stop terminated a sleep 60 child within 500 ms. The useful composer/control-lane UI work here can be salvaged separately on top of #4229.

    7. juliusmarminge closed this

Sign in to join this conversation.