Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(orchestrator): report terminal runs after wait timeout #11574

Mergedsaphid(GitHub profile, opens in a new tab)merged 1 commit intot3code/codex-turn-mapping fromrefs/pull/11574/headmerged by juliusmarminge View on GitHub

Summary

A run can finish while waitForThread is handling its timeout. The timeout path already re-reads the projection, but it unconditionally reported timedOut: true even when that final read showed the run had reached a terminal status. Callers saw a completed (or failed/interrupted/cancelled/rolled-back) run mislabeled as timed out.

timedOut is now recomputed from the final projection read: a terminal run is reported as completion, a still-active run remains timed out, and a vanished run still raises ThreadManagementRunNotFoundError.

Validation

  • Reproduced the defect first: terminal-at-timeout scenarios returned timedOut: true before the fix (5 failing cases).
  • vp test run apps/server/src/orchestration-v2/ThreadManagementService.test.ts — 14/14 pass. New parameterized cases use Deferred + TestClock to park the wait inside its poll until the timeout wins, then assert the final-read outcome for all five terminal statuses, a still-active run, and the missing-run error.
  • Targeted vp lint, vp fmt, and tsc --noEmit on apps/server are clean for the touched files.

Prior art

Adapted from the approach in #11156 by @kiiwee (thanks!) — that PR went stale/conflicted against the current V2 base; this carries the same core fix rebased fresh, with coverage extended to every terminal run status.


Implemented by SWE-2 (Devin) running in T3 Code. Coordination: OV2 campaign saphid/t3code-personal#298, worker thread 5810b980-142f-4c85-9c18-8dcadb41dc76.

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

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

      Approvability

      Verdict: Approved at 2819efa

      Macroscope's review found this PR approvable — This is a small, self-contained fix to report terminal runs correctly after a wait timeout, with deterministic coverage for all terminal and non-terminal outcomes. It does not introduce new capabilities, schema changes, configuration changes, or deployment risk.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. saphid(GitHub profile, opens in a new tab)commented

      @juliusmarminge this PR is ready for review/merge. (ov2-julius-ready)

      Verified at head 1492e36c (rebased onto the current base 24476841; earlier heads: 2819efac, 85d7fcee, faf05212, a51e715a, c880f6f9 — identical diff throughout):

      • Fix: waitForThread recomputes timedOut from the final projection read after the timeout wins the race — a run that reached a terminal status in that window reports completion instead of a false timeout; still-active runs stay timed out; a vanished run still raises ThreadManagementRunNotFoundError.
      • Tests: 14/14 focused tests pass locally and in CI — Deferred/TestClock parameterized cases cover all five terminal statuses at-timeout (completed, failed, cancelled, interrupted, rolled_back), a still-running control, and the missing-run error.
      • Reviews: independent GPT-6 Astra reviews clean on the frozen diff (0 findings across repeated identical-diff passes; xhigh pass verified diff SHA-256); Macroscope Approvability APPROVED (approval recorded at 2819efa, identical diff).
      • CI: all checks green or expected skips on this head — Check, Test, Test Server 1–3, Release Smoke, Rust all success. mergeable_state: clean.

      Adapted from the approach in #11156 by @kiiwee, extended to cover every terminal run status.

    4. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

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

      Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting).

      This review would cost an estimated $72.40, which exceeds your per-review limit of $15.00.

      The top 3 files driving up this estimate:

      FileDiff SizeEstimate
      apps/server/src/orchestration-v2/Orchestrator.ts317.09KB$15.85
      packages/contracts/src/orchestrationV2.ts112.59KB$5.63
      apps/server/src/provider/acp/AcpRegistrySupport.ts73.23KB$3.66

      Tip

      To get this pull request reviewed, you can:

      1. Comment @macroscope-app on this PR to request a manual review (monthly spend limits still apply).
      2. Exclude the file(s) above from review by adding a pattern to your .macroscope/ignore.md — note that creating this file replaces Macroscope's built-in default ignores rather than extending them.
      3. Raise your cost limit in your workspace billing settings.
      [Turn off this reminder going forward](https://app.macroscope.com/pingdotgg/settings#Personal)
    6. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

    7. juliusmarminge merged this779a880

    8. juliusmarminge closed this

Sign in to join this conversation.