Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): stop both completion-wake task cohorts #15331

Mergedmatsvarn(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/15331/headmerged by juliusmarminge View on GitHub

Stopping a completion-wake run disposes its incoming completion cohort, but tasks delegated during that wake can still deliver another completion. Stop now disposes both cohorts through the existing orchestrator path, reading pending events between disposals. Ordinary runs dispose their one cohort once; the broader holdQueue Stop behavior stays intact.

Fixes #15325. Rebuilt from @matsvarn’s #15331, preserving the original commits and merging current main.

Verification:

  • Replaced the original regression with one lifecycle scenario in the existing DelegatedCompletionDelivery.test.ts: both cohorts stop, incoming results survive, a late child result stays available without another wake, and newer user work remains unchanged.
  • Exact main: 20 passing cases and the new regression failing (undefined wake-cohort disposition, expected stopped). Temporary minimum proof: all 21 pass. Candidate: all 21 pass; together with ThreadStop.test.ts and BackgroundWorkStop.integration.test.ts, 65 tests pass. Server package typecheck, scoped type-aware lint, formatting and diff checks passed (two existing lint warnings). Independent full-diff Opus and Sol reviews found no code issues (one round).
  • Primary focused candidate rerun: ran the new lifecycle scenario against the final candidate successfully (1 passed, 20 unrelated cases skipped). The scenario exercises persisted Stop and late-completion outcomes; this is service-level verification, not a live provider demonstration.
  • The test runs the real orchestrator and persistence services with deterministic provider boundaries. No UI changes; screenshots do not demonstrate this server behavior.
  • Not verified with a real provider interrupt, remote/relay/tunnel connection, Electron desktop, macOS, Windows, iOS, or Android.

Models and harness: tests by Codex gpt-6-astra; implementation by Codex gpt-6.1-sol; independent reviews by Claude Opus 5.5 and Codex gpt-6-sol. T3 Code delegation through the Codex and Claude Agent harnesses.

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

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

      Approvability

      Verdict: Approved at be98547

      Macroscope's review found this PR approvable — This narrowly scoped server fix reuses the existing cohort-disposal path to stop both cohorts created by a completion wake, while leaving ordinary and hold-queue behavior unchanged. A focused lifecycle test covers late results and preservation of newer work.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Warning

      Review limit reached

      Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

      Next included review available in 10 seconds.

      Check out review usage here.

      View limit details

      Limit details: You’ve used all 10 included reviews currently available.

      Learn how review limits work.

      Review configuration:

      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: cf4b5ef1-19b8-4ea3-af67-84e6458e63a0
      📥 Commits

      Reviewing files that changed from the base of the PR and between d2120010593e8befd5821421f4bfb106c3a39b64 and be985477a3b5dcfde737b494e2d113c964e4a0b7.

      📒 Files selected for processing: 2
      • apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
      • apps/server/src/orchestration-v2/Orchestrator.ts

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 0317decc-7885-408e-aeaa-7e97de328ee4
      📥 Commits

      Reviewing files that changed from the base of the PR and between a21702d0e58ad20263dc965d84472bb6d7eb38c8 and d2120010593e8befd5821421f4bfb106c3a39b64.

      📒 Files selected for processing (2)
      • apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
      • apps/server/src/orchestration-v2/Orchestrator.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      📝 Walkthrough

      When a delegated-completion wake run is interrupted, the orchestrator now disposes delegated completions for both the wake run and its owning run. A test checks the delivery and run dispositions.

      Changes: Delegated completion interruption

      Layer / File(s)Summary
      Dispose the completion cohort
      apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
      The interruption path processes the wake run and its owning run, reloading each projection with pending events before disposing the cohort. The test checks that the new task’s delivery is disposed and both runs have disposition stopped.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to d2120

      The interruption fix is ready to merge after normal checks.

      ### Architecture Summary

      Architecture risk: 🟡 Medium · up to d2120

      The change affects 1 system.

      Changed systems: apps/server

      Architecture concerns No architecture-level concerns identified.

      Review details

      Systems and components

      • observed — apps/server (service) was modified; 2 changed files map to changed impact.

      Before / after behavior

      • observed — Modified behavior in apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts: Adds a test that seeds a claimed incoming task, starts its completion-wake run, creates a new task in that run, and interrupts it. The assertions expect the new task’s delivery to be disposed and both the wake run and origin run to be stopped.
      • observed — Modified behavior in apps/server/src/orchestration-v2/Orchestrator.ts: stopCompletionCohort now processes both the delegated completion’s parent run (when present) and the interrupted run, instead of disposing only the single parent-or-current run previously selected. For each, it reloads the projection with pending events and disposes the cohort with disposition stopped.

      Reliability and maintainability

      • inferred — Risk-relevant change factors for apps/server: blast_radius_1; direct_dependents_1
      Pre-merge checks: Passed 5
      Check nameStatusExplanation
      Docstring CoveragePassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly and concisely identifies the main fix: stopping both completion-wake task cohorts.
      Description checkPassedThe description explains the problem, the implementation, linked issue context, focused verification, test results, and known limitations. Although it does not use every template heading explicitly, i…
      Full details: Docstring Coverage

      Explanation

      No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

      Full details: Description check

      Explanation

      The description explains the problem, the implementation, linked issue context, focused verification, test results, and known limitations. Although it does not use every template heading explicitly, it provides the required information in a mostly complete form.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. juliusmarminge assignedjuliusmarminge

    6. Taking over this one. I’ll port the Stop cleanup to current main, keep a focused regression test, and run independent reviews before pushing here. Thanks @matsvarn for isolating the bug.

    7. juliusmarminge changed the title

    8. juliusmarminge merged this6cd6372

    9. juliusmarminge closed this

Sign in to join this conversation.