fix(acp): support root session replacement in V2 - #1
Draft
nullStack65 wants to merge 1 commit into
Draft
nullStack65 wants to merge 1 commit into
nullStack65 wants to merge 1 commit into
Conversation
An agent can replace the root session behind the same ACP connection: omp's /fresh starts a new provider session and publishes every later session/update under a new id while the original id stays the one session/load replays. The V2 runtime treated those updates as a foreign child session, so the thread went silent for the rest of the turn. Add a generic, default-off runtime capability (AcpSessionRuntimeOptions.adoptRootSessionReplacement) that adopts a new live root session id first seen while a root prompt is in flight, at most once per prompt, and projects adopted notifications back onto the durable setup id. Prompts, cancellation, session loading, and item identity keep using the durable session; foreign ids seen while idle stay rejected. The ACP Registry adapter exposes the opt-in per instance through AcpRegistrySettings. The frozen bespoke reference is PR pingdotgg#11973; this slice carries only the provider-neutral adoption mechanism.
This was referenced Sep 23, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this is
Fork-held slice for the V2 architecture (
USE_GENERIC_ACP_V2_WITH_SMALL_GENERIC_FIXES). It adds the generic, provider-neutral root-session-replacement capability the V2 ACP runtime needs so an agent that swaps its root session behind the same connection (omp/fresh) does not go silent.pingdotgg/t3code#28293d45b305632c72cbb8fd8a6dd5077b94c25d7eb5orchestrator-v2-base-3d45b3056(3d45b3056)feat/acp-root-session-adoption-3d45b3056(9ba3a54d83c0fc4f8317ae605bd6a6a528213396)4749035bda13b4b6260499caedbc0d69a2f60e6fpingdotgg/t3code#11973@4f9419b72bb92bebc6669dd95f345e1ccdf4bcedProblem
An agent can replace the root session on the same ACP connection. Real omp 18.2.4 behavior, proven live:
session/new, addressable, replayable viasession/load);/fresh;session/updatenotification arrives under a new id B, including the direct response to the/freshprompt;session/listonly ever shows A;/fresh.Design (generic, no provider branches)
AcpSessionRuntimeOptions.adoptRootSessionReplacement(defaultfalse) plusonRootSessionReplacedfor diagnostics.session/load,session/close, model/config requests, and assistant item identity all keep using the durable id.AcpRegistrySettings.rootSessionReplacement(defaultfalse, generic, usable by future agents). No global relaxation for every registry agent. Noif agent === "oh-my-pi"anywhere.Net change: 6 files, ~+609/-5.
Tests
apps/server/src/provider/acp/AcpJsonRpcConnection.test.ts— new root-session-replacement block (all green, 47/47 total):root before fresh)onRootSessionReplacedreports each change onceAdditional green:
AcpRegistryAdapterV2.test.ts3/3 — includes a new end-to-end test through the real registry runtime with the instance opt-in.AcpAdapterV2.test.ts105/105 (V2 provider adapter runtime policy).OrchestratorReplayFixtures.integration.test.ts73/73 (V2 replay fixtures).apps/servertsc --noEmit: clean.packages/contractstsc --noEmit: clean.vp linton every changed file: clean.git diff --check: clean.darwin-x86_64distribution, so the pre-existing E2E test failed on this host. Same failure reproduces on the base snapshot3d45b3056(ACP Registry agent fixture-agent has no compatible distribution for darwin-x64), classified as a base/host fixture gap, now fixed in the fixture (no production code).Live zero-inference proof (real omp 18.2.4, registry PR pingdotgg#613 metadata)
OMP updated to 18.2.4; local binary sha256
780a47a5...matches the exactdarwin-x86_64sha256 inagentclientprotocol/registry#613(eed36bcaa677749b0bdf24010dfc3883834612c9). Registry JSON served from an injected HttpClient using the exactoh-my-pi/agent.jsonmetadata;commandPathpointed at the localomp;authMethodId: "agent". No model prompt; only local commands (/context,/fresh,/rename).Through the patched V2 registry adapter (
rootSessionReplacement: true):session/new:01a0b151-096c-.../contextfix(acp): support root session replacement in V2 #1 →Context window: 272000 tokens (6% used)(updates flow)/fresh→Fresh provider session started (1 provider state pruned)./contextfix(server): opt-in fail-closed policy for codex thread resume #2 (post-fresh) →Context window: ...— updates continue through the patched runtime/freshunchanged:01a0b151-096c-...Direct
AcpSessionRuntimewithadoptRootSessionReplacement: true:startid A =01a0b151-102d-...;session/listcontains A/fresh→onRootSessionReplaced { previousSessionId: A, sessionId: 01a0b151-12be-... }(live identity observed without overwriting A)session/cancelsucceeds on A/contextafter/freshsucceedssession/load(A)returns A;session/listafter load still contains ADependencies / not covered here
agentclientprotocol/registry#613(oh-my-pi18.2.4). This branch does not vendor registry metadata.