GeezerVison is showing github.com — fix(provider-acp): retire Copilot tasks when their runtime ends by NicL9923 · Pull Request #32476 · pingdotgg/t3code
Conversation
NicL9923
commented
Nov 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This fixes ghost agents in T3. If Copilot crashes or its process is replaced, T3 marks that process's abandoned background agents as interrupted instead of showing them as running forever.
Problem
A discarded Copilot ACP runtime can leave its native background subagents marked running. Reusing the native session can carry those tasks into the replacement runtime, and stale child attribution can route replacement output to an old task.
Change
Retire Copilot's carried and active native subagents when their runtime terminates or is replaced, including rollback. Each task receives one interrupted update. Keep Copilot's attribution maps with the runtime that produced them, including the native tool identities used to classify MCP and search calls. Both live and replayed session updates use that runtime when normalizing events.
Invalidate old callbacks before restarting an ACP runtime and cancel its pending requests, so an unanswered approval cannot keep the replacement runtime's inactivity timeout paused. Task retirement and routing isolation are specific to Copilot; other ACP flavors retain their task carryover behavior, and detached root shell commands are unchanged.
Scope
A focused fix for an obvious lifecycle bug: a discarded runtime must not leave its process-owned agents running in T3. No maintainer approval is claimed. Routing isolation is part of the same fix because replacement output must not reach a retired task.
Verification
- Updated through upstream
main at 8f34bb193a, with head 5bdcc10f12. The update includes merge commit 88d9845c35 and replay-normalization correction 8734e6e52c. The merge retains upstream's Copilot 1.0.114+ child attribution, MCP/search tool identity, deferred-tool termination handling and replacement startup reporting.
vp run check:changed on 5bdcc10f12: 167 tests in two files passed; typechecks for 14 affected packages, format, lint, knip and GraphQL checks passed. The initial run exposed a missing runtime argument in upstream's newly added replay-history path; the correction passes the same source runtime used for live updates.
- Focused runs on the merge commit passed all four Copilot runtime-replacement cases and eleven Copilot Registry cases. They cover termination, active-prompt termination, rollback, tasks whose work can survive the transport, stale callbacks, replacement output, foreground completion, child routing, and MCP/search identity. The merged replacement case also retains upstream's startup sequence assertion.
- Earlier regression runs failed before immediate-termination and rollback cleanup. Removing ownership checks, callback invalidation or approval cancellation made their corresponding assertions fail. These establish that the assertions detect the failures, rather than only describing the fixture.
- The retirement fixture uses a mock ACP subprocess for session setup, stubbed prompts and injected events. No new app or live-provider testing was performed for this update. Julius separately recorded the stale-task failure and its correction with real Copilot 1.0.112 at
ec164b5c91; that evidence was not repeated on this head.
The last independently reviewed head is 06b2502faa. Claude Opus 5.5 High found no blocking issues in that integration, following earlier reviews that led to immediate-termination cleanup, rollback cleanup and stronger stale-callback assertions. The new main merge, its conflict resolutions and the replay-normalization correction have not received another independent review because this change has reached the configured review-round limit.
Implemented by GPT-6.1 Terra High and GPT-6.1 Sol High through Codex, with the approval-cleanup follow-up and earlier merge resolutions by Claude Opus 5.5 High through Claude Code, in T3 Code. Earlier independent reviews used Claude Opus 5.5 High and GPT-6.1 Sol High; current unreviewed changes are listed above.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved at 28ac21d
Macroscope's review found this PR approvable — Copilot task attribution is now isolated per runtime, and outstanding task statuses are retired when that runtime ends or is replaced. The change is bounded lifecycle bookkeeping, with other providers retaining their existing retirement behavior.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Use the following commands to manage reviews:
@coderabbitai resume to resume automatic reviews.
@coderabbitai review to trigger a single review.
Use the checkboxes below for quick actions:
- Resume reviews
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
The adapter now scopes Copilot session attribution to the runtime that produced each notification. It retires runtime-owned subagents during termination and replacement. Tests cover termination, rollback, stale runtime events, replacement output, and a pending approval that remains after runtime termination.
Changes: Copilot runtime lifecycle
| Layer / File(s) |
Summary |
Runtime-scoped session attribution packages/provider-acp/src/server/adapter.ts, packages/provider-acp-registry/src/server/copilotAcp.ts |
Session-update handling passes the source runtime to normalization. Copilot routing keeps a separate session attribution map for each runtime. |
Runtime-owned subagent retirement packages/provider-acp/src/server/adapter.ts, packages/provider-acp-registry/src/server/adapter.ts, apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts |
The Copilot flavor declares that subagents are runtime-owned. The adapter retires those subagents during runtime termination and replacement. Tests cover termination, rollback, stale runtime events, replacement output, and pending approval timeout behavior. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant AcpRuntime
participant AcpAdapterV2
participant CopilotRouting
AcpRuntime->>AcpAdapterV2: Send session notification
AcpAdapterV2->>CopilotRouting: Normalize notification with source runtime
CopilotRouting->>CopilotRouting: Use source runtime's session map
Loading
Suggested reviewers: juliusmarminge, maria-rcks
Merge Risk: Minimal · up to b9c31
-
This change retires Copilot subagent tasks when their ACP runtime exits or is replaced, so they no longer show as running. It also scopes attribution to each runtime so stale output does not reach retired tasks. The reviewed code and the added regression tests cover the termination, rollback and pending-approval cases. No blocking issue remains, though live Copilot termination was not tested.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the change: Copilot tasks (native subagents) are retired when their ACP runtime ends. This matches the summary's termination and replacement retirement logic and the objectives. It is … |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
| Description check |
 |
The description explains the problem (ghost Copilot subagents stay marked running after runtime crash or replacement), the change (retiring carried and active native subagents, per-runtime attribution… |
Full details: Title check
-
Explanation
The title names the change: Copilot tasks (native subagents) are retired when their ACP runtime ends. This matches the summary's termination and replacement retirement logic and the objectives. It is specific and follows the conventional commit style of the repository template. It does not mention the routing isolation and callback invalidation parts, which is acceptable because it need not cover every detail.
Full details: Description check
-
Explanation
The description explains the problem (ghost Copilot subagents stay marked running after runtime crash or replacement), the change (retiring carried and active native subagents, per-runtime attribution maps, callback invalidation before ACP runtime restart), and the scope (a focused lifecycle bug fix, no maintainer approval claimed). The Verification section lists concrete commands, test counts, and observed results, and it states what was not checked (no manual app testing, no live Copilot process testing). The template's Scope section asks for a linked issue that shows the bug. The description links a PR and a comment but no issue, and it does not explain why no issue is needed beyond calling it an obvious bug. The reviewer-model and harness line is present, as the template requests. The description is long and contains some review-history detail that is not template content, and it is dense in places. Overall the required sections are substantively complete.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 5b4904a and b9c3104.
Files selected for processing: 3
-
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
packages/provider-acp-registry/src/server/copilotAcp.ts
packages/provider-acp/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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…sk-cleanup
# Conflicts:
# apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…sk-cleanup
# Conflicts:
# apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
# packages/provider-acp-registry/src/server/copilotAcp.ts
# packages/provider-acp/src/server/adapter.ts
…n left open
Advancing the callback generation before restarting skips the generation-gated
cleanup of pending runtime requests. An approval left open by a finished turn
then stayed pending and paused the replacement runtime's inactivity deadline.
Cancel pending requests after the advance, as the other restart paths do.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
maria-rcks
commented
Nov 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Note Written by gpt-6.1-sol on behalf of Maria
Verified in a real dev environment
verified as-is at b9c3104d8272f5c35cb402bad8fea6cf777b2b10, against github/main at 14a60e85e5 on linux. installed each revision with vp i, ran one isolated dev server at a time, and drove the web app with repository playwright and /usr/bin/google-chrome. the project, threads, and turns were created through the app without fixtures.
used real copilot cli 1.0.112 over acp with gpt-6.1-sol, configured through settings with its supported byok openai responses endpoint to the vm proxy.
- on main, launched a native background task, let its parent finish, then terminated the captured copilot runtime pid. the child incorrectly remained working after the process exited.
- on this head, repeated the same flow. the child became interrupted, with exactly one persisted interrupted update.
- another prompt in the same parent started a replacement runtime and returned
REPLACEMENT_PARENT_OK. a new native background task completed normally, while the old child remained interrupted.
- a separate native codex
gpt-6.1-sol thread completed a real read-only shell tool and returned CODEX_PROVIDER_OK with the package name.
both existing acp adapter suites passed on blacksmith: 162 tests across AcpAdapterV2.test.ts and AcpRegistryAdapterV2.test.ts. the head's ci snapshot had 32 successful checks, zero failing or pending. no source changes, commits, or pushes.
main after runtime exit:

pr after runtime exit:


command transcript and persisted event timeline. uploaded video playback and seeking were checked in chrome.
Not verified
rollback, active-prompt termination, approval-left-open restart, detached root-command preservation, and delayed callback attribution were not exercised with a live provider; the passing existing tests cover those paths but are not live proof. github-hosted copilot inference/login was not used because this vm's available model access is its proxy. other acp flavors, native desktop/mobile clients, remote relay/tunnel, macos, and windows were not exercised on this linux vm.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Real web app, Chromium, light theme, 1280×800 CSS viewport, fresh isolated databases, real Copilot CLI 1.0.112 / Auto.
Requested one background subagent running sleep 900 && echo done, explicitly keeping the subagent's shell command in the foreground while the parent replied launched. Killed the real Copilot ACP runtime after the task showed Running. Both runtime and sleep disappeared. Base retained Running / Waiting / Lineage · 1 running; head immediately retired the task as interrupted (displayed Stopped). A later pong prompt finally cleared base's stale task. Repeated with sleep 901 and left idle for more than three minutes: the difference persisted.
Images are frames extracted from the recordings. Seed and reproduction script, runtime-kill driver, second-round driver, observed task lifecycle. Head recorded one interrupted update per task; its first retired task received no further update when the replacement runtime answered pong.
Not shown:
- Rollback-triggered runtime replacement and overlapping stale-callback output races were not exercised; this proof covers runtime death and a later normal restart.
- Other ACP providers' existing task carryover behavior was not exercised.
- Sustained systemd idle-inhibitor retention was not established; the captured regression is the stale task and thread UI state.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.
See the conflict window.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|