Repository navigation
fix(provider-acp): ACP threads keep receiving events after a rollback - #28987
maria-rcks merged 3 commits into
Conversation
When rollback or a forced new native thread replaced the ACP runtime, the replacement's event consumer was forked into the previous runtime's scope, which the same transition then closed. Nothing read the replacement's events afterwards: onSessionEvent stopped, the event queue grew unbounded, and wait-for-prompt cancellation waited on an unacknowledged drain barrier until its timeout killed the agent. Fork the consumer into the replacement scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Replacement ACP runtimes now keep their event subscriptions in their own lifecycle scope, preventing old-runtime cleanup from stopping subsequent events. The change is narrowly contained and preserves existing cleanup and callback safeguards. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note Written by Verified in a real dev environmentverified head native codex reproduction: complete a turn, send another prompt, stop, choose "edit from here" and "revert and keep changes", resubmit, then stop the replacement runtime. server traces show: the main ui still displayed "stopped by user" despite the server timeout. server traces distinguish the failure from the pr result. after the pr rollback and stop, a follow-up real tool turn requested approval, ran the existing rollback regression test passed on blacksmith: 1 passed, 84 filtered out. existing head ci checks pass. short server verification transcript Not verifiednative electron, ios and android clients; antigravity and fx oauth; remote relay and tunnel connections; the separate forced-new-thread path through |
**v0.1.7-nightly.20261104.4151** · 155 changes from 31 contributors - **Share thread links.** Copy a thread link to share anywhere and open the thread directly. - **Secret-backed usage limits.** Use a secret provider such as 1Password for usage-limit source keys. - **Windows Group Policy.** Windows administrators can configure T3 Code using a Group Policy template. - **Faster pairing.** New pairing links display their QR code immediately in Settings. - **Saved drafts.** Drafts saved by older versions now survive updates. - **Codex threads.** Codex threads open in another client are no longer silently replaced. - **Background work.** Queued provider or model switches no longer end running background agents and commands. ### Plus 137 more bug fixes and performance improvements. <details> <summary>Full changelog</summary> ## What's Changed * fix(github): Rebase stack no longer conflicts after a lower layer is squash-merged by @saphid in pingdotgg/t3code#29919 * fix(server): changing a task's wake policy no longer reverts a checkpointed parent run by @juliusmarminge in pingdotgg/t3code#25662 * perf(server): settled PR lookups stop re-spawning git every sweep by @juliusmarminge in pingdotgg/t3code#29721 * fix(server): generated commit and PR text ignores git signature output by @saphid in pingdotgg/t3code#29580 * fix(web): picking a branch in a subfolder project keeps the thread in the project folder by @saphid in pingdotgg/t3code#29908 * fix(mobile): close and reopen pull requests from the actions menu by @juliusmarminge in pingdotgg/t3code#29962 * fix(web): mouse wheel over the thread minimap glides instead of jumping by @flamboh in pingdotgg/t3code#29038 * fix(server): managed policy covers Kiro by @juliusmarminge in pingdotgg/t3code#29915 * fix(server): t3 update installs from the policy's update mirror by @juliusmarminge in pingdotgg/t3code#29911 * fix(desktop): Ctrl+R on macOS reaches the preview page instead of reloading it by @saphid in pingdotgg/t3code#29893 * fix(server): native forks after an undo no longer copy later turns by @saphid in pingdotgg/t3code#29902 * fix(server): idle compaction still runs after a queued message is removed or steered by @saphid in pingdotgg/t3code#29904 * fix(server): guests of a forked thread can open files on the messages it inherited by @saphid in pingdotgg/t3code#29794 * fix(evals): resume browser verification after unavailable status by @Yash-Singh1 in pingdotgg/t3code#30298 * fix(shared): saving one source control token no longer drops the other hosts' tokens by @yordis in pingdotgg/t3code#29554 * fix(desktop): a policy that stops startup no longer points at another release by @juliusmarminge in pingdotgg/t3code#30319 * docs: pin an absolute binary path under a permission cap by @juliusmarminge in pingdotgg/t3code#29916 * fix(mobile): Android follow-up menu shows in full with the keyboard open by @juliusmarminge in pingdotgg/t3code#29263 * fix(web): deleting the open thread no longer opens a snoozed or settled thread by @juliusmarminge in pingdotgg/t3code#29643 * fix(web): closing Settings or Usage no longer jumps back to a quote's source by @juliusmarminge in pingdotgg/t3code#29013 * fix(server): squash-merged branches no longer offer push & create PR by @juliusmarminge in pingdotgg/t3code#28494 * fix(mobile): settings providers show the ACP registry icon by @juliusmarminge in pingdotgg/t3code#28135 * fix(server): Grok usage limits tell Legacy-mode xAI accounts to switch to Privacy Mode by @juliusmarminge in pingdotgg/t3code#28097 * fix(usage): label a proxied Claude account by its e-mail, and drop .json from hub rows by @juliusmarminge in pingdotgg/t3code#28065 * fix(gitlab): a signed-out default glab host no longer hides other signed-in hosts by @juliusmarminge in pingdotgg/t3code#27840 * perf(server): prune events the projections already cover by @juliusmarminge in pingdotgg/t3code#29806 * fix(server): GPT-6.1 Sol no longer compacts after every tool call on managed Codex by @maria-rcks in pingdotgg/t3code#30004 * feat(policy): admins set managed policy from a Group Policy template by @juliusmarminge in pingdotgg/t3code#29862 * perf(server): bound streaming recovery reads by active runs by @Yash-Singh1 in pingdotgg/t3code#30357 * perf(server): read pull request metadata from a lightweight snapshot by @Yash-Singh1 in pingdotgg/t3code#30356 * fix(server): cancelling worktree setup no longer leaves its new branch behind by @saphid in pingdotgg/t3code#29781 * feat(mobile): add on-device Android dictation by @PixPMusic in pingdotgg/t3code#26734 * feat(server): read usage limit source keys from a secret provider by @yordis in pingdotgg/t3code#27760 * feat(device): read the EAS access token from a secret provider by @yordis in pingdotgg/t3code#27763 * fix(server): route missing read-only queries to readers by @Yash-Singh1 in pingdotgg/t3code#30366 * perf(server): index delegated recovery candidates by @Yash-Singh1 in pingdotgg/t3code#30359 * feat(server,web,mobile,desktop): Copy thread copies a link that opens the thread by @juliusmarminge in pingdotgg/t3code#26290 * feat(mobile,web): copied thread links open the mobile app by @juliusmarminge in pingdotgg/t3code#29815 * fix(antigravity): rate-limited turns keep their reset time by @saphid in pingdotgg/t3code#29594 * fix(server): startup no longer hangs on a shell stuck in the kernel by @AdEx-Partners-DE in pingdotgg/t3code#27938 * fix(server): reverting files before the first commit no longer leaves them staged by @Abhishek-B-R in pingdotgg/t3code#28647 * fix(server): truncated Claude task output no longer starts with a replacement character by @Abhishek-B-R in pingdotgg/t3code#28643 * fix(shared): relative file links with routing punctuation open as files by @Abhishek-B-R in pingdotgg/t3code#28637 * fix(server): messages cut by a restart no longer stay marked as streaming by @Abhishek-B-R in pingdotgg/t3code#28646 * fix(server): Antigravity Auto asks instead of approving every request by @parmartejass in pingdotgg/t3code#23698 * fix(server): Codex threads open in another client are no longer silently replaced by @derektrimm in pingdotgg/t3code#21045 * fix(server): WSL servers avoid ports already used by Windows by @tylerjenningsw in pingdotgg/t3code#22962 * perf(web): reuse repeated inline skill lookups by @luke2x in pingdotgg/t3code#29008 * fix(opencode): expand home-relative executable paths by @voltcrash in pingdotgg/t3code#29326 * fix(server): title regeneration works after a thread's worktree is cleaned up by @saphid in pingdotgg/t3code#29606 * fix(server): dev servers a Codex agent starts show under its thread by @saphid in pingdotgg/t3code#29687 * fix(server): status no longer fetches a remote named after a local tracked branch by @saphid in pingdotgg/t3code#29670 * fix(server): preview snapshots no longer cut an emoji in half by @saphid in pingdotgg/t3code#29600 * fix(server): restart notes no longer split an emoji in a long background task label by @saphid in pingdotgg/t3code#29647 * fix(acp): Always allow no longer cancels the turn when an agent only offers allow-once by @MarcoDotIO in pingdotgg/t3code#29463 * fix(server): forking a Codex thread archived outside T3 Code no longer fails by @saphid in pingdotgg/t3code#29618 * perf(shared): stop single-token message search at the best hit by @hieu-lee in pingdotgg/t3code#28930 * fix(preview): a dropped stream withdraws its stale file picker by @saphid in pingdotgg/t3code#29655 * fix(provider-acp): ACP threads keep receiving events after a rollback by @trevoedwards in pingdotgg/t3code#28987 * perf(opencode): provider event logs skip per-token reply deltas by @saphid in pingdotgg/t3code#29673 * fix(web): open files from Claude and ACP tool-call diffs by @Jo2234 in pingdotgg/t3code#29309 * fix(server): files tree labels ignored folders inside git submodules by @saphid in pingdotgg/t3code#29650 * fix(server): server updates reclaim partial database backups left by killed updates by @MarcoDotIO in pingdotgg/t3code#29464 * fix(server): PR watch wakes no longer split an emoji in a long comment by @saphid in pingdotgg/t3code#29633 * fix(server): pinning a settled thread stamps its return to the active list by @saphid in pingdotgg/t3code#29602 * fix(server): Claude's commands no longer run Electron apps as Node by @u9g in pingdotgg/t3code#29413 * docs: keybindings guide lists the rightPanelOpen when key by @saphid in pingdotgg/t3code#29677 * perf(shared): avoid redundant visibility work on status updates by @hieu-lee in pingdotgg/t3code#28965 * fix(desktop): failed settings saves no longer leave temp files behind by @saphid in pingdotgg/t3code#29635 * fix(acp): a final agent message without a trailing newline is no longer dropped by @saphid in pingdotgg/t3code#29605 * fix(server): terminal history keeps output after an unterminated OSC by @saphid in pingdotgg/t3code#29604 * fix(cli): t3 up's pairing hint keeps --base-dir by @saphid in pingdotgg/t3code#29684 * fix(shared): preserve omitted components in zero-major caret ranges by @Jo2234 in pingdotgg/t3code#29335 * fix(server): thread titles use linked PR context when the URL is followed by a colon or bold markers by @saphid in pingdotgg/t3code#29656 * fix(source-control): remotes like github.com:owner/repo reach their host by @MarcoDotIO in pingdotgg/t3code#29457 * fix(server): terminal history keeps text with C1 characters by @saphid in pingdotgg/t3code#29649 * fix(server): worktree handoff follows the project's start-from-origin setting by @saphid in pingdotgg/t3code#29810 * fix(server): review keeps tracked changes when untracked files overflow the listing by @saphid in pingdotgg/t3code#29615 * fix(server): browser setup advice names the server's T3 home by @saphid in pingdotgg/t3code#29646 * fix: honor generic MIME aliases in attachment previews by @Jo2234 in pingdotgg/t3code#29360 * fix(client-runtime): terminals fit their pane again after a reconnect by @saphid in pingdotgg/t3code#29696 * fix(server): Run now on a scheduled task says why it was refused by @saphid in pingdotgg/t3code#29620 * fix(server): a preview_open whose first load fails no longer leaves a hidden tab behind by @saphid in pingdotgg/t3code#29865 * fix(cursor): Cursor text generation names usage-limit failures by @saphid in pingdotgg/t3code#29748 * fix(server): review diffs keep working with untracked files outside the sparse cone by @saphid in pingdotgg/t3code#29880 * fix(opencode): nested custom commands like /git/commit run as commands by @saphid in pingdotgg/t3code#29765 * fix(source-control): renamed files in GitHub, GitLab and Azure DevOps diffs show as renames by @saphid in pingdotgg/t3code#29774 * fix(opencode): a command that exits non-zero is stored as failed, not completed by @saphid in pingdotgg/t3code#29824 * fix(server): linked environments pick up the other machine's new name by @saphid in pingdotgg/t3code#29779 * fix(server): document text skips tracked deletions and field codes by @saphid in pingdotgg/t3code#29796 * fix(server): OTLP export settings survive a saved token streaming mode by @saphid in pingdotgg/t3code#29786 * fix(server): Word text boxes are no longer extracted twice for agents by @saphid in pingdotgg/t3code#29827 * fix(server): new projects are created when core.safecrlf refuses LF files by @saphid in pingdotgg/t3code#29843 * fix(web): drafts saved by older versions load instead of being wiped by @saphid in pingdotgg/t3code#29828 * fix(server): Antigravity text generation shows sign-in and setup errors by @saphid in pingdotgg/t3code#29823 * fix(web): picking a custom model named like a Codex alias keeps that model by @saphid in pingdotgg/t3code#29789 * fix(server): turn checkpoints keep LF files when core.safecrlf is true by @saphid in pingdotgg/t3code#29826 * fix(shared): find in thread matches a word typed with a curly apostrophe by @saphid in pingdotgg/t3code#29759 * fix(server): review rows for nested repositories load in large diffs by @saphid in pingdotgg/t3code#29693 * fix(server): t3_worktree_list lists refs after storage cleanup removes a thread's worktree by @saphid in pingdotgg/t3code#29645 * fix(provider-core): text generation context cuts no longer split an emoji by @saphid in pingdotgg/t3code#29653 * fix(server): html_preview no longer splits an emoji in a long console line by @saphid in pingdotgg/t3code#29844 * fix(server): diffs keep submodule changes under diff.submodule=log by @saphid in pingdotgg/t3code#29852 * fix(opencode): OpenCode 2 titles for image messages skip images the server cannot open by @saphid in pingdotgg/t3code#29819 * fix(server): orchestrator_capabilities no longer offers providers the project turned off by @saphid in pingdotgg/t3code#29842 * fix(web): big terminal selections no longer break sending by @saphid in pingdotgg/t3code#29804 * test(web): file editor dismissal test waits for the editor to render by @juliusmarminge in pingdotgg/t3code#30350 * test(web): worked-for heading test clicks once the list is revealed by @juliusmarminge in pingdotgg/t3code#30404 * fix(azure-devops): legacy DefaultCollection pull request URLs can be pasted to check out by @saphid in pingdotgg/t3code#29763 * fix(shared): preview_open reports about: and mailto: as unsupported instead of misreading them by @saphid in pingdotgg/t3code#29614 * fix(server): delegated threads no longer share one provider event log by @onlydole in pingdotgg/t3code#29770 * fix(server): a queued provider switch no longer ends background work by @juliusmarminge in pingdotgg/t3code#30401 * fix(kiro): slow kiro-cli starts no longer show Kiro as unavailable by @saphid in pingdotgg/t3code#29841 * fix(client): mark unread sticks on a thread reopened within ten minutes by @saphid in pingdotgg/t3code#29814 * fix(pi): extension errors name folder extensions instead of "index" by @saphid in pingdotgg/t3code#29768 * fix(github): Enterprise Server pull request URLs can be pasted to check out by @saphid in pingdotgg/t3code#29892 * fix(server): a peer refusing one call no longer marks its link as failing by @saphid in pingdotgg/t3code#29914 * perf(server): Claude skill discovery resolves each repository root once by @onlydole in pingdotgg/t3code#29757 * fix(server): t3 service uninstall leaves another T3 home's service alone by @saphid in pingdotgg/t3code#29872 * fix(server): PR watches wake again when a push leaves the branch conflicting by @saphid in pingdotgg/t3code#29767 * fix(muse): the thread error banner no longer shows unredacted failure text by @saphid in pingdotgg/t3code#29910 * fix(server): provider settings changed mid-refresh no longer revert to the old status by @saphid in pingdotgg/t3code#29894 * fix(shared): accept whitespace after engine range operators by @romil-bijarnia in pingdotgg/t3code#29730 * perf(server): stop tracing per-event live coalescer work by @onlydole in pingdotgg/t3code#29758 * test(desktop): the Windows shell kill test waits for each spawn before advancing the clock by @maria-rcks in pingdotgg/t3code#30463 * fix(shared): ignore unsupported command output control parameters by @romil-bijarnia in pingdotgg/t3code#29736 * fix(cli): t3 update no longer says a service awaiting restart runs the new version by @saphid in pingdotgg/t3code#29901 * fix(mcp): accept CR and mixed line endings in response streams by @romil-bijarnia in pingdotgg/t3code#29727 * fix(server): preview tabs that fail during setup no longer leave their page open by @saphid in pingdotgg/t3code#29885 * fix(provider-core): long subagent titles no longer end in a broken character by @saphid in pingdotgg/t3code#29906 * fix(shared): ignore unsupported command output erase modes by @romil-bijarnia in pingdotgg/t3code#29737 * fix(server): a failed scheduled run shows its error without a stack trace by @saphid in pingdotgg/t3code#29889 * perf(web): long threads stream with 70% less work-row derivation by @Entrpi in pingdotgg/t3code#29971 * fix(pi): send SIGTERM before closing Pi's stdin on teardown by @yaacovcorcos in pingdotgg/t3code#30025 * fix(server): clean up child worktrees after their parent settles by @voltcrash in pingdotgg/t3code#30026 * fix(server): Claude context meter shows the window for models outside the catalog by @hahhforest in pingdotgg/t3code#30051 * fix(server): quitting no longer waits on an unreachable telemetry endpoint by @levelorbit in pingdotgg/t3code#30033 * fix(client): keep snoozed failures hidden without completion times by @voltcrash in pingdotgg/t3code#30063 * perf(server): PR sync stops reading pull requests closed over a day ago by @advaitpaliwal in pingdotgg/t3code#30071 * fix(acp): file changes show the patch of every diff in a tool call by @Abhishek-B-R in pingdotgg/t3code#28631 * fix(server): Antigravity sign-in no longer blames the network while the runtime starts by @wenshen18643 in pingdotgg/t3code#30079 * fix(relay): read migrations in checkout paths with spaces by @domvox in pingdotgg/t3code#30080 * fix(cli): validate npm runtime before caching it by @voltcrash in pingdotgg/t3code#30099 * fix(server): SSH device host no longer reconnects on a single slow health probe by @gyurix in pingdotgg/t3code#30159 * fix(server): read continued core.bare values during onboarding by @imharjot in pingdotgg/t3code#30174 * fix(server): published repos fall back to HTTPS when SSH is refused by @saphid in pingdotgg/t3code#30142 * fix(opencode): fail stalled event subscriptions promptly by @voltcrash in pingdotgg/t3code#30201 * fix(server): a link card the user moved past no longer blocks auto-settle by @saphid in pingdotgg/t3code#29847 * fix(server): deleting a thread also removes its agent preview recordings by @saphid in pingdotgg/t3code#29853 * fix(server): review guides no longer fail on the repository's checkout hooks by @saphid in pingdotgg/t3code#29907 * fix(desktop): bump Electron to 44.10.1 for October Chromium security backports by @valuin in pingdotgg/t3code#30161 * chore(repos): sync reference repos from shallow clones by @juliusmarminge in pingdotgg/t3code#30472 * chore(repos): sync Effect 4.1.2 and Alchemy beta.85, rename effect-smol by @juliusmarminge in pingdotgg/t3code#30481 * Revert "fix(web): terminal controls no longer cover the first line" by @juliusmarminge in pingdotgg/t3code#30493 * feat(web): show a newly created pairing link without expanding the client list by @juliusmarminge in pingdotgg/t3code#30498 ## New Contributors * @Abhishek-B-R made their first contribution in pingdotgg/t3code#28647 * @tylerjenningsw made their first contribution in pingdotgg/t3code#22962 * @Jo2234 made their first contribution in pingdotgg/t3code#29309 * @u9g made their first contribution in pingdotgg/t3code#29413 * @onlydole made their first contribution in pingdotgg/t3code#29770 * @romil-bijarnia made their first contribution in pingdotgg/t3code#29730 * @Entrpi made their first contribution in pingdotgg/t3code#29971 * @hahhforest made their first contribution in pingdotgg/t3code#30051 * @levelorbit made their first contribution in pingdotgg/t3code#30033 * @advaitpaliwal made their first contribution in pingdotgg/t3code#30071 * @wenshen18643 made their first contribution in pingdotgg/t3code#30079 * @domvox made their first contribution in pingdotgg/t3code#30080 * @gyurix made their first contribution in pingdotgg/t3code#30159 * @imharjot made their first contribution in pingdotgg/t3code#30174 * @valuin made their first contribution in pingdotgg/t3code#30161 **Full Changelog**: pingdotgg/t3code@v0.1.7-nightly.20261103.4138...v0.1.7-nightly.20261104.4151 </details> Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.7-nightly.20261104.4151

Problem
After an ACP thread is rolled back (or
ensureThreadforces a new native thread), the replacement runtime's events are never consumed.flavor.onSessionEventstops firing for that thread, the runtime's event queue grows for as long as it lives, and on agents withcancelBehavior: "wait-for-prompt"Stop waits on a drain barrier nobody acknowledges until the 15s cancel timeout kills the agent and Stop fails with "The ACP agent did not finish cancellation".Cause, in
packages/provider-acp/src/server/adapter.ts:wireAcpRuntimeHandlersforks thegetEvents()consumer intoruntimeScope ?? sessionScope. In the replacement path it is called whileruntimeScopestill points at the previous runtime's scope;runtimeScope = replacementScopeis only assigned afterwards, and the same transition then closespreviousScope, interrupting the consumer it just started.Change
wireAcpRuntimeHandlerstakes an optionalscope, and the replacement path passesreplacementScope, so the consumer lives as long as the runtime it reads. The initial start and restart paths already assignruntimeScopebefore wiring and are unchanged. I passed the scope explicitly rather than moving the assignment earlier because the replacement path only swapsruntimeScopeafter confirming the replacement has not already terminated; assigning it earlier would make a terminated replacement's scope the active one.Scope and approval
A very small, focused fix for an obvious bug: the replacement path forks a fiber into a scope it closes a few lines later, unlike the two other paths that wire handlers. No behavior change beyond making the replacement runtime's event handling work like the original runtime's.
Verification
replaces the ACP session and clears conversation state on rollback(apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts) to countonSessionEventcalls and drain the replacement runtime's events after the post-rollback turn.drainEvents(vp test run src/orchestration-v2/Adapters/AcpAdapterV2.test.ts -t "replaces the ACP session and clears conversation state on rollback" --testTimeout 20000→Test timed out in 20000ms).AcpAdapterV2.test.tsandAcpRegistryAdapterV2.test.ts.vp run check:changedpasses (fmt, lint, knip, typecheck, affected tests).Claude Opus 5.5 in cooperation with Trevor.