Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): queue Copilot follow-ups without killing background agents #26715

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/26715/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Steering a Copilot thread interrupts its prompt and kills its native background agents. This change queues Copilot follow-ups until the current prompt finishes, so background work survives and the follow-up runs afterward.

Copilot's ACP adapter now reports that interrupt-and-restart steering is unsupported. The server uses the existing durable queue when a provider supports queueing but cannot steer safely. Other ACP providers keep their current capabilities. Stop remains available. Explicit Restart through t3_thread_send now reports unsupported for Copilot because the existing restart policy uses the same capability; use Stop followed by a new message when cancellation is intended.

The reporter was on macOS. The Copilot capability override in makeAcpRegistryAdapterV2 and the queue decision in resolveMessageDispatchIntent have no OS-specific branch. The orchestrator applies this decision before provider effects run, so the corex composer verification exercises the same cancellation prevention on macOS. Web, desktop and mobile send through EnvironmentCommands.startThreadTurn and CommandPolicy.resolveMessageDispatchIntent; their queue views use deriveThreadQueueWorkflowState from packages/client-runtime/src/state/threadWorkflows.ts.

Closes https://github.com/pingdotgg/t3code/issues/26695

Client evidence

Captured in the real web client on corex with isolated development state and official Copilot CLI 1.0.105 over ACP. Before: main 7632c3dc7039953cc50282e1bc339e1bf11f2ffc. After: this PR's head e313525eccea0fe85d8dad6a80563835032c2787. Both used gpt-6-luna; Copilot also routed the native child to Luna. A transparent ACP proxy recorded protocol milestones without changing the messages. The source servers ran with vp run dev --home-dir <isolated-home> --no-seed, and the web clients used the same-origin Vite proxy.

The reporter's prompt was sent through the composer:

Launch ONE background agent (task tool, mode background) that runs sleep 90; echo BG_DONE. Then run sleep 40 yourself in the foreground, then reply DONE.

While the background shell was running, the composer sent: "After the background agent completes, reply FOLLOWUP_DONE."

Before, the follow-up cut off the current attempt. Copilot cancelled its background agent 18 seconds into the 90-second shell command. The earlier completed turn above it is a separate attempt without a follow-up. Copilot later restarted background work to answer the follow-up; the original child was cancelled.

Before: the default Steer follow-up cuts off the active attempt

After, the follow-up stays queued below the running background agent instead of interrupting it.

After: the follow-up stays queued while the background agent runs

The background shell then finishes with BG_DONE, and the queued follow-up completes with FOLLOWUP_DONE.

After: background work and the queued follow-up both complete

The ACP transcript confirms what the client shows. Times are UTC on 2026-10-29.

Before, main 7632c3d:
05:28:11.819  subagent.started
05:28:17.567  background shell started
05:28:35.781  session/cancel
05:28:35.800  subagent.completed cancelled:true
05:28:35.833  first prompt result: cancelled
05:28:36.028  follow-up prompt started

After, head e313525:
05:33:19.616  subagent.started
05:33:26.506  background shell started
               composer follow-up queued while the shell ran
05:34:56.602  background shell completed, exit 0, BG_DONE
05:35:00.827  subagent.completed, gpt-6-luna
05:35:08.703  first prompt result: end_turn
05:35:10.103  queued follow-up prompt started
05:35:12.617  follow-up result: end_turn, FOLLOWUP_DONE

The fixed run recorded zero session/cancel and abort events. Both prompts completed successfully.

Verification

The branch was updated with main 3748c5c241a2740f2e0856e2c2a3f9d8ee7ff8e9 in merge commit fdfe353eb0723d53d6772b9f7ad79d08432cc531. All five files in this fix are identical to e313525eccea0fe85d8dad6a80563835032c2787, so the client captures and local command output still cover the unchanged fix.

The client captures and runtime transcript above cover head e313525eccea0fe85d8dad6a80563835032c2787. No new setting, UI, contract or protocol change is included.

The following commands ran on corex against that committed head. Each PNG renders the full captured text log, including the full SHA, command, timestamps, result and exit code.

Three focused suites, 49 tests, captured command output Five neighboring suites, 99 tests, captured command output Changed-file checks, captured command output

Recorded results:

Head: e313525eccea0fe85d8dad6a80563835032c2787
Focused command: vp test run src/orchestration-v2/CommandPolicy.test.ts src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts src/orchestration-v2/SteeringCompletion.integration.test.ts
 Test Files  3 passed (3)
      Tests  49 passed (49)
Exit code: 0

Neighbor command: vp test run src/orchestration-v2/ClaudeAutomaticDelivery.integration.test.ts src/orchestration-v2/ThreadLaunchService.test.ts src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts src/orchestration-v2/OpenCode2OrchestratorV2.integration.test.ts src/orchestration-v2/DispatchModeLimit.test.ts
 Test Files  5 passed (5)
      Tests  99 passed (99)
Exit code: 0

$ vp run check:changed origin/main
check:changed: 5 files since 5b89a5358562
Nothing changed since the last passing run.
check:changed summary
  pass  format  0.5s
  pass  lint  1.4s
  pass  knip 1/2  15.7s
  pass  knip 2/2  26.9s
  pass  graphql (apps/server)  1.1s
  pass  typecheck (10 packages)  16.4s
  pass  test (3 files)  60.0s
Exit code: 0

The focused suites cover Copilot capability identification, explicit and automatic dispatch resolution, and queued delivery without interruption. The neighboring suites cover automatic delivery, thread launch, provider switches, OpenCode dispatch and dispatch limits.

vp run check:changed origin/main validated its existing passing result for unchanged inputs and exited 0. Its output explicitly reports cache reuse, with successful format, lint, both knip passes, GraphQL generation, typechecking of 10 affected packages and the three touched test files.

CI output for this head passed Check, Test, all eight server shards, Test Web, and Build and Typecheck. Independent GPT-6.1 Sol review found no blocking correctness findings; its request to disclose the explicit Restart limitation is addressed above.

Implemented by Opus 5.5 with Claude Code. Investigated, tested and reviewed by GPT-6.1 Sol with Codex.

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

      Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — Copilot follow-ups will queue instead of interrupting and restarting active work, preserving background agents but delaying redirection. This changes existing delivery behavior and requires a human decision on that product-default tradeoff.

      No code changes detected at fdfe353. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB+29 B (+0.6%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB+29 B (+2.3%)2.0 KiB✅
      CodexLive turn WebSocket decoded21.5 KiB21.6 KiB+41 B (+0.2%)24.4 KiB✅
      CodexLive turn messages12+1 (+100.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.1 KiB+6 B (+0.1%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.3 KiB1.3 KiB+6 B (+0.5%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: 3748c5c · PR result: fdfe353 · 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: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

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

    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between d46463140776d3d45f0ce705a36e6b411f1d4b5d and e313525eccea0fe85d8dad6a80563835032c2787.

      Files selected for processing: 5
      • apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
      • apps/server/src/orchestration-v2/CommandPolicy.test.ts
      • apps/server/src/orchestration-v2/CommandPolicy.ts
      • apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts
      • packages/provider-acp-registry/src/server/adapter.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

      The ACP Registry adapter disables interrupt-and-restart steering for Copilot. Dispatch policy queues messages for active runs when the provider supports neither steering mode but supports queued messages. Regression tests cover capability reporting, dispatch decisions, and queued follow-up execution.

      Changes: Copilot Follow-up Dispatch

      Layer / File(s)Summary
      Copilot turn capabilities
      packages/provider-acp-registry/src/server/adapter.ts, apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
      The adapter disables interrupt-and-restart steering for Copilot. Tests check Copilot and Gemini turn capabilities.
      Active-run dispatch policy
      apps/server/src/orchestration-v2/CommandPolicy.ts, apps/server/src/orchestration-v2/CommandPolicy.test.ts
      Shared helpers identify active runs and resolve provider turn capabilities. When an active run supports neither steering mode and queued messages are supported, dispatch queues the message. Tests cover queueing, restart behavior, and a missing explicit target.
      Queued follow-up execution
      apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts
      The integration test verifies that a follow-up stays queued during the active turn, does not steer or interrupt it, and starts as a new turn after the current turn completes.
      Priority: Normal

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Possibly related issues

      • Issue 26695 describes Copilot background agents being cancelled when a follow-up uses interrupt-and-restart steering. This change disables that steering capability for Copilot and queues follow-ups when the provider cannot steer.

      Possibly related PRs

      • pingdotgg/t3code#25749: Both changes adjust message dispatch and queued follow-up behavior based on whether a provider turn is running.
      • pingdotgg/t3code#22802: Both changes define delivery behavior for messages sent during active work.
      • pingdotgg/t3code#25035: Both changes address steer-versus-queue behavior for messages that cannot be steered.

      Suggested labels: bugfix

      Suggested reviewers: t3dotgg, juliusmarminge

      Merge Risk: Minimal · up to e3135

      No merge-blocking regression was identified in the queued follow-up change.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: queueing Copilot follow-ups to prevent background agents from being cancelled.
      Linked Issues checkPassedIssue [#26695] requires Copilot follow-ups to reach Copilot without cancelling native background agents. packages/provider-acp-registry/src/server/adapter.ts identifies registry and local Copilot co…
      Out of Scope Changes checkPassedThe changed source, policy logic, and regression tests directly support issue [#26695]. The Copilot capability change prevents destructive cancellation. The dispatch change selects the existing durabl…
      Description checkPassedThe pull request description covers the problem, expected behavior, implementation changes, scope, linked issue, verification steps, observed results, platform limitations, and agent disclosure. The s…
      Full details: Linked Issues check

      Explanation

      Issue [#26695] requires Copilot follow-ups to reach Copilot without cancelling native background agents. packages/provider-acp-registry/src/server/adapter.ts identifies registry and local Copilot commands and disables interrupt-and-restart steering. apps/server/src/orchestration-v2/CommandPolicy.ts queues active-run messages when the provider supports queued messages but supports neither safe steering method. The added integration test verifies that the follow-up remains queued, does not interrupt the current turn, and starts after completion. The capability and policy tests cover Copilot identification and automatic and explicit dispatch resolution.

      Full details: Out of Scope Changes check

      Explanation

      The changed source, policy logic, and regression tests directly support issue [#26695]. The Copilot capability change prevents destructive cancellation. The dispatch change selects the existing durable queue. The tests verify the required behavior and preserve provider-specific capability behavior. No unrelated product, client, protocol, or UI changes appear in the reviewed scope.

      Full details: Description check

      Explanation

      The pull request description covers the problem, expected behavior, implementation changes, scope, linked issue, verification steps, observed results, platform limitations, and agent disclosure. The scope section does not include an explicit maintainer approval comment, but it links the triaged issue and clearly explains why the focused bug fix stays within scope.

      Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.

Sign in to join this conversation.