Skip to content

Continue sessions across agent CLI upgrades - #1413

Draft
taras wants to merge 7 commits into
mainfrom
codex/issue-891-unified-resume
Draft

taras wants to merge 7 commits into
mainfrom
codex/issue-891-unified-resume

Conversation

@taras

@taras taras commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

REPL UI evidence

Checkpoint Fixture Viewport Action Reference Before After Comparison
codex-upgrade Production provider with controlled ACP runtime and host-selected executable 160 × 36 Establish review on Codex 0.167.1, then resume on 0.169.1 No approved design asset; this checkpoint verifies actual provider refusal versus quiet successful continuation. Before codex-upgrade After codex-upgrade —

Mounted typing latency

Viewport 200 × 52. Milliseconds from character dispatch to the completed emulator write containing the changed Message value.

Workload Samples per run Before median After median Δ median Before p95 After p95 Δ p95
small 30 11.013 10.690 -0.323 11.754 11.743 -0.011
wrapping 30 18.261 18.279 0.018 19.219 19.486 0.267

Why

Closes #891. Upgrading Codex or Claude could stop an existing XMD conversation because the executable version or digest changed.

What changes

XMD selects the executable from the current environment and continues the retained conversation after the provider confirms the same native identity. Successful continuation is quiet. Real executable, resume and identity failures still stop the operation.

Before, an upgrade could refuse the prompt (generated session key abbreviated):

session "<retained session>" was created by codex-cli 0.167.1 and this run would use codex-cli 0.169.1, so the conversation it names cannot be confirmed

After, the prompt completes in the retained conversation. The controlled fixture in the captures returns:

Retained conversation continued.

That reply is fixture output. XMD adds no version-change or undetermined-version notice. The same synthetic fixture establishes a session under emulated Codex 0.167.1, then resumes under 0.169.1, checking the exact native assertion, explicit resume target, selected executable environment and requested turn count. Separate integration regressions recover context supplied only to the original conversation.

The paired captures use baseline 76535a3ab46c32645a4431bce9b56b8297bc0017 and candidate d7f65f3938a53b9ac7796ba56eed91b1dd884f1f, both at 160×36.

How it works

The host selects the current executable and carries it into ACP and native execution. The provider uses existing ACPX exact-resume and expected-identity capabilities. Confirmation precedes settings, prompts and established native handoff. Fresh native creation confirms its allocated identity after the child joins.

ACP release joins before native spawn. A failed release stops handoff even if later cleanup succeeds. Delayed confirmation and replay configuration re-enter the host's existing withSessionRoute pin; the native child runs outside it.

Fresh construction uses existing unbound V1 records. Released V2/V3 records and journals retain their original facts. Original accounts still have to agree where both supply bindings; today's version and digest never decide admission.

Review guide

Start with specs/decisions/005-current-executable-session-continuation.md, then the ACP/native specs and packages/acp/src/provider.ts.

Trace strict reopening, native confirmation/release order, LaunchInvocation.route, historical record agreement and completed replay. Native NR9 protects failed-release handoff; Test Agent TL11 protects delayed ACP work using the correct host route. Review context-recovery/refusal regressions alongside executable-selection cases.

What must stay true

  • Missing or different required native assertions never create replacement history.
  • Instructions, permissions, exclusive ownership, cancellation and joined cleanup stay enforced.
  • Old durable records remain readable and unchanged.
  • Completed replay restores retained output without executable selection, observation, provider calls or native spawn.

How to verify it

The runtime change at signed 35ea371623e985f3c2facf1199eb867e2831c481 passed:

Focused check Groups Steps
Provider/native/legacy/usage 59 412
Selection/workflow/assembly 17 87
Test Agent/UI/output 38 146
Remaining shared ACP-helper consumers 6 21

The later proof/spec correction at 996e9b9a passed 22 groups/180 steps covering native launch and Test Agent, five executable proof documents in unset-opt-in refusal mode, Deno/Node typing, documentation validation and repository lint. Its production source edits remove an unread member and update comments/whitespace.

The fourth correction at signed d7f65f3938a53b9ac7796ba56eed91b1dd884f1f changes only the Claude attachment proof fixture. Current version measurement is optional evidence and runs after the negative control. The absent-identity control uses fixed historical V2 metadata. Complete static branch traces cover unfamiliar output and thrown observation; neither can gate the verdict or control. Fixture Deno/Node typing, the document's unset-opt-in branch, documentation validation, formatting and lint passed. No opted-in paid/live proof was run.

The synthetic REPL continuation journey and preflight at d7f65f39, at 160×36 and 72×20, passed. The publishing workflow supplies the exact capture hashes and native paired typing measurements above.

Focused commands
deno task test packages/acp/tests/provider.test.ts packages/acp/tests/host-conversation.test.ts packages/acp/tests/released-runtime.test.ts packages/acp/tests/claude-reconnect.test.ts packages/acp/tests/native-launch.test.ts packages/acp/tests/session-route.test.ts packages/acp/tests/prompt-usage.test.ts packages/agent/tests/agent-session-launch.test.ts packages/runtime/tests/executable-observer.test.ts
deno task test packages/cli/tests/session-compatibility.test.ts packages/cli/tests/adversarial-session-continuity.test.ts packages/cli/tests/workflow-agent-sessions.test.ts packages/cli/tests/agent-session-coordinator.test.ts packages/acp/tests/adapter-materialization.test.ts
deno task test packages/test-agent/tests/provider.test.ts packages/test-agent/tests/native-launch.test.ts packages/test-agent/tests/components.test.ts packages/cli/tests/repl-agent-journey.test.ts packages/cli/tests/repl-sidekick-journey.test.ts packages/cli/tests/repl-exec-output.test.ts
deno task test packages/acp/tests/loaded-copy.test.ts packages/acp/tests/acceptance.test.ts packages/acp/tests/acpx-session-save.test.ts packages/acp/tests/session-key.test.ts

Final proof-only checks:

deno check packages/acp/tests/fixtures/claude-native-to-acp-proof.ts
pnpm exec tsc --project tsconfig.node.json --noEmit
deno task xmd test packages/acp/src/ClaudeNativeToAcp.test.md --raw
deno task validate:docs
pnpm exec oxfmt --check packages/acp/tests/fixtures/claude-native-to-acp-proof.ts
pnpm exec oxlint -c .oxlintrc.json packages/acp/tests/fixtures/claude-native-to-acp-proof.ts

The proof command ran with both attachment opt-ins unset. The final lint command exited 0 with one existing control-regex warning on untouched line 312.

Scope

Current executable selection, confirmation of retained conversations, native attachment/replay, deterministic regressions and coherent specifications/proofs. Warning-only APIs, state and UI plumbing are removed. No new version-history store or journal field is added.

No ACPX vendored runtime, Claude adapter/SDK, producer recipe, generated snapshot, dependency or lockfile changes are required.

Review and delivery status

Current signed head: bbff2453750997cd5241a496987975eb33d03615, tested tree dbdfe69a2116e030bd1fd7f5893e8416f0d8b515. Correction 6 implements the two residual findings below, following correction 5's five fixes. Changed workflow selection joins close and strictly reopens the original conversation; compatible live selection still reuses its handle. Proof addressing, subprocess submission counting, child classification, integration references and optional observations are corrected.

All 18 focused final checks passed: 33 groups/186 steps for workflow/provider, 29 groups/247 steps for native/legacy/replay, and four proof cases each under Deno, Node and Bun, plus typing, five unset-opt-in proof documents, documentation validation and affected lint/format checks. The new real-workflow test first reproduced A→A on the unchanged parent for both providers. No opted-in live provider or paid turn ran.

  • Signed correction matches the tested final candidate tree; checkout clean.
  • Original Architect exact-commit review of bbff2453 is running; prior reviews remain recorded.
  • Original Planner acceptance of bbff2453 follows.
  • Same independent Astra 6.2/high reviewer must re-review bbff2453. Its prior CHANGES REQUIRED finding remains historical until closed by actual feedback.
  • Prior paired evidence at d7f65f39 is published and both attachment files verified; current-head refresh is pending.
  • Required CI and main-health delivery gates pass.

Findings awaiting correction-6 re-review

  • Eager named-session resolution on an ACP-only host can open B while A's handle remains owned. This public session(name) caller produces a details preparation that bypasses the new existing-entry guard. The two-Prompt workflow switch regression passes; named eager resolution still needs the same joined-release guarantee.
  • The Claude proof classifier drops an unexpected interactive creation such as claude --session-id different when it lacks the expected private instruction-file flag. The actual parsers preserve the call, but the filter hides it from no-child/no-substitution controls. It must count or explicitly reject unexpected interactive argv while excluding known non-UI operations.

Controlled real host-selector/provider/wire probes and a synthetic shim trace substantiate these findings without a model turn. The other prior runtime/proof findings are closed by the independent trace. The original Planner froze the finite supplement for source round 6/6, and the retained Astra 6.2 Implementor signed bbff2453 after all 18 focused checks passed. The new permanent tests first reproduced both residual defects on source 5. Exact-commit internal and independent reviews remain due. No further permission is pending. Both prior internal PASS receipts remain preserved as their actual reviews.

The PR remains a draft. These feedback reviews do not establish CI completion or authorize merge.

@taras
taras marked this pull request as ready for review November 18, 2026 09:20
Every established session — ordinary Session/Prompt, held conversations,
native launch, client-native attachment and incomplete replay — now uses the
executable the current environment selects, reopens the exact retained
conversation, and requires the provider's live assertion of the same native
identity. Version and digest observations are diagnostic history: a change
warns once per logical session per invocation on stderr and never refuses.
Missing or different assertions and real resume failures still refuse
without creating a replacement.

- Generalize strict reopening (expectedAgentSessionId) beyond held Codex.
- Select the host executable once, observe that same file, execute it.
- Confirm client-native handoffs over ACP: before a native resume, and after
  a fresh creation once the child joins; exit status is never identity.
- Retire build-drift admission and legacy refusals based only on missing
  historical observation; keep original-record agreement.
- Add AcpxProviderDependencies.compatibilityWarnings, shared per CLI
  invocation; show held Sidekick stderr beside the reply.
- Amend ACP, native launch, workflow and REPL specs, architecture, and
  decision records 004/005; proof fixtures record versions as evidence.
@taras
taras force-pushed the codex/issue-891-unified-resume branch from 1ee7919 to b283f08 Compare November 18, 2026 09:22
@taras
taras marked this pull request as draft November 18, 2026 09:32
A configured prepared-only replay reopened its conversation, reconfigured
it, and then could not give ACP up. Its scope recorded the close failure for
teardown and answered success, so the detach retried the close and, when that
retry succeeded, recorded a detach and started the native UI. The replay now
stops with detach-failed before any detach or spawn; teardown still owes and
reports the original failure.

NR9 reproduces the reviewed probe: the first close fails, later closes would
succeed, and no native launch is requested. The native launch spec no longer
says a build-bound agent requires an executable observer.
The user withdrew version history and compatibility notices: a session
continues on the executable the current environment selects, under the
provider's positive confirmation of its retained native identity, and says
nothing about the change.

- Remove warnCompatibility, AcpxProviderDependencies.compatibilityWarnings and
  executableObserver, the CLI invocation set and its forwarding, the workflow
  diagnostic observer, MachineSessionAssembly's observer, writeDiagnostic, and
  the Sidekick held-stderr reading and rendering.
- Production no longer hashes or parses executables. Selection stays with the
  host selectors and their launchability check; custom commands are untouched.
- Fresh routes are released unbound V1. Existing V2/V3 routes and journals stay
  byte-preserved; their original bindings are still compared when both exist.
- Launch detach/exit ACP work (reconfiguration and native confirmation) now
  runs under the launch's session route pin, as preparation already did, so a
  host that pins routes places the post-child confirmation correctly (TL11).
- Remove the Test Agent controlled observer and build version; replace test
  fake observers with a controlled host-selection double.
- Amend architecture, ACP, native, workflow and REPL specs and decisions 004/005.
The opt-in live proofs still required bound fresh routes and pinned CLI
releases, and the specs still described version reporting and bound V2/V3
fresh construction.

- ClaudeNativeToAcp: assert the unbound V1 fresh route and an absent journal
  binding, check only that route and journal agree, and keep the observed
  version and digest as recorded evidence. The absent-identity case still
  publishes a historical V2 route.
- Codex native and zero-turn documents: Codex release, digest and platform are
  evidence; only the carried adapter identity is asserted; fresh routes carry no
  build.
- Claude launch documents: version and platform are evidence. The zero-turn
  journey accepts XMD's own confirmation refusal (identity-unavailable, no
  re-entry child) as the exact-identity refusal it is.
- Native and ACP specs: fresh construction is unbound V1 and nothing about an
  executable's version is compared or reported.
- Remove the unreadable NativeBinding.versionArgs, the stale boundSessions
  comment and leftover blank lines.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Codex and Claude sessions continue across CLI upgrades

1 participant