Skip to content

fix: forked claude-cli conversation starts with an empty model context - #155591

Merged
Patrick-Erichsen merged 1 commit into
openclaw:mainfrom
Marvinthebored:fix/fork-keeps-claude-cli-session
Oct 2, 2026
Merged

Patrick-Erichsen merged 1 commit into
openclaw:mainfrom
Marvinthebored:fix/fork-keeps-claude-cli-session

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #155590

Forking a native CLI conversation copied the visible transcript but dropped the native context. The child could therefore forget the parent conversation; the live-reply path also lacked the callbacks needed to branch the native session safely.

This keeps the contributor's checkpointed fork handoff and integrates it with current main's shared CLI session owner. Whole-session Gateway and automatic parent forks copy only checkpointed bindings whose backend supports both fork and checkpoint resume. The child drops the parent's force-reuse flag and reseed receipt, retains account/environment validation, claims its one-shot fork, and persists the new native session ID for later turns. Per-message forks remain fresh because they use a different transcript cutoff.

The maintainer repair also:

  • Prepares plugin/backend information before the SQLite transaction and retains the authoritative parent/child reread at commit.
  • Shares claim, successor persistence, and restore callbacks across command and live reply. Cancellation rejects claims and successor writes; cleanup can restore an unspent marker while its exact owner remains current.
  • Uses the prepared native runner's capability checks, removing duplicate discovery in callers. Existing catalog-adopted force-reuse bindings keep their established behavior.
  • Fixes the original missing-agentId/literal-type CI errors and removes two exports that became production-unused.

No schema, configuration option, protocol, migration, or stored-field shape changes.

Reviewer verification

Integration base: 8ae1e870c1ad684b32be61bd3d460e06deb083e5. Candidate commit: 989056f18ab145cc6a4769647104b4516d700671.

Paired regressions fail on current-main production for the Gateway fork builder, public sessions.create, and automatic parent-fork owner. Additional incoming-candidate controls fail for missing checkpoint-resume capability, plugin normalization inside BEGIN, and cancelled live claim/successor writes; all pass after the owner repair.

317 targeted and sibling tests passed. After the final caller simplification, the affected live and command suites passed again (95 tests). Coverage includes real SQLite publication, released/replaced owners, retry restoration, auth profile/epoch invalidation, legacy IDs, catalog force reuse, unsupported backends, and native runner spawn/recovery behavior.

Fresh native proof uses candidate fork construction, the actual admission/execution and SQLite callback owners, installed Claude CLI 2.1.219, and an isolated deterministic local Anthropic API fixture. It uses no cloud credentials or production profile:

Step Observed result
Parent initial turn PELICAN-42; native ID 75f9928d-…; checkpoint recorded
Fresh child control NO-CODEWORD
Parent advances after fork snapshot TURTLE-99, same parent native ID
Missing fork / checkpoint-resume capability controls Rejected before native spawn/model request; fork marker retained
Candidate checkpoint-pinned child PELICAN-42, distinct ID c7bb4368-…
Next plain child resume PELICAN-42, same child ID
Parent after child turns TURTLE-99, same parent ID and unchanged parent binding

All six native processes exited 0; the proof test passed in 4.681s. A separate seven-process native dependency probe also showed that an unpinned fork sees the later TURTLE-99, proving the saved checkpoint matters. These are reviewer-run native proofs with a local model fixture. The contributor's authenticated throwaway-Gateway trace is retained below and is separate evidence.

Canonical autoreview (Codex, default P0 scope) exited 0, scoped-clean, with no findings. The full changed-file gate passed: production types, all 27 test type graphs, all Knip scans, lint/format, storage guards, and zero runtime import cycles. Required full build verification for 989056f18ab145cc6a4769647104b4516d700671:

  • pnpm build passed, exit 0, 446.515 seconds; Node 24.19.0 and pnpm 12.5.1 with frozen dependencies in an isolated source workspace and synthetic HOME.
  • Full profile completed all six core and both plugin SDK declaration invocations, runtime-postbuild validation, CLI bootstrap-import and SDK-export checks.
  • The emitted build-info commit matches the published head. All 21 pinned source/build-input hashes remained unchanged; build and bootstrap processes joined.
  • No ineffective dynamic-import warning references the changed Gateway/CLI modules. Three UI import warnings concern 13 modules byte-identical to base 8ae1e870c1ad684b32be61bd3d460e06deb083e5, with unchanged UI/build configuration. Named UI follow-up: consolidate mixed static/dynamic imports for session roster caching, snapshot invalidation, and composer draft persistence.

Build log SHA-256: f0ebacafa6eb061e18cd2e6c234976a3292c79cabdd6d3f9716c2fe9badefacc. This completes the build gate alongside the published paired native CLI and Gateway proof.

Test cost and scope

Per-file Vitest wall time includes hooks; wrapper compilation/import overhead is separate. These measured times address the latest ClawSweeper Rank-up moves request.

Changed test file Tests Wall time
src/agents/cli-session.test.ts 27 0.006s
src/gateway/session-create-fork-entry.test.ts 6 0.044s
src/gateway/server.sessions.create.forks.test.ts 20 24.013s
src/config/sessions/session-accessor.parent-fork.test.ts 17 7.493s
src/auto-reply/reply/agent-runner-execution-cli-admission.test.ts 17 18.675s
src/agents/cli-session-store.test.ts 29 4.889s
src/agents/command/attempt-execution.cli.test.ts 78 18.365s

Available prior-head CI run: 151 jobs, 51,380 summed job-seconds. This is total job time, not marginal PR cost. Selected jobs: build-artifacts 304s; test-types-core-4 160s; test-types-core-2 244s; dependencies 79s. The three latter failures were the fixture types/unused exports repaired here; final exact-head CI is the landing gate.

Production: +144/-47, net +97 lines. Tests: +491/-44, net +447. Docs: +1. Sharing callbacks and removing caller backend discovery absorbs existing duplication; the remaining growth implements the missing checkpointed native handoff at both creation owners and the live caller's lifecycle-safe publication. No parallel state store or provider-specific core policy is added.

Original implementation and authenticated Gateway proof by @Marvinthebored; maintainer integration and additional verification are AI-assisted through Codex.

Contributor's original report and earlier revision proof

Closes #155590

AI-assisted (Claude Code, run by @Marvinthebored); reviewed and tested by a human.

What Problem This Solves

Fixes an issue where users who fork a conversation running on a native CLI backend (claude-cli) would get a child session that starts with an empty model context. The Control UI shows the parent's transcript in the child, but the agent's first reply behaves like a brand-new session because the native claude process is started fresh instead of resuming the parent's session. This affects Control UI Fork conversation, sessions.create with fork: true, and sessions_spawn with context: "fork".

Why This Change Was Made

Forked session entries now carry the parent's CLI session bindings, marked for a one-shot fork resume, so the child's first turn resumes the parent's native session with the backend's fork flag (--fork-session for claude-cli) and then keeps its own new native id, as the existing forkNextResume machinery already supports. The copied binding does not set forceReuse: the child's first turn runs the same auth profile, auth epoch, cwd, and MCP checks as any other stored session, so an account or environment change starts the child fresh instead of resuming under the wrong credential. Only bindings with a recorded resumeCheckpointId are copied, because the runner pins the fork resume to that checkpoint (--resume-session-at); without one the branch point would follow whatever the parent did next. Only backends that expose a fork flag are copied; any other backend starts a fresh native session as before, since resuming without a fork flag would share the parent's native thread. Legacy per-session ids on a reused target and the parent's reseed receipt are dropped, because both name a session that is not the child's. Per-message "Fork from here" is intentionally unchanged: it cuts the transcript at an earlier point, so a fresh native session is correct there.

Live testing surfaced a second gap: the live chat turn runs through src/auto-reply/reply/agent-runner-cli-candidate.ts, which never passed forkCliSessionOnResume or the fork-store claim/restore/persist callbacks to the CLI runner. Only src/agents/command/attempt-execution.ts did. With the marker set but ignored, the child resumed the parent's native session without --fork-session and shared the parent's thread. The callback wiring now lives in one shared helper, buildCliSessionForkRunParams in src/agents/command/session-store.ts, used by both callers, so the two paths cannot drift apart again.

A third gap was in the shared successor writer, persistCliSessionForkSuccessorInStore in src/agents/command/session-store.ts. When the child's first turn claims the fork and the backend reports the new native id, that writer rebinds the child before the rest of the turn can fail, so a retry does not re-fork the parent. It used to write forceReuse: true on that rebinding, which resolveCliSessionReuse treats as an unconditional reuse. Between successor persistence and the next completed turn, a change of auth profile, auth epoch, cwd, or MCP config would then have been ignored. The writer now spreads the source binding and replaces only sessionId, so the parent's fingerprints carry over and a later turn validates the successor like any other stored session. A source binding that already carries forceReuse (catalog adoption of an external session, which has no fingerprints) keeps it, so that path is unchanged.

User Impact

Forking a claude-cli conversation now produces a child that remembers the parent conversation, matching what the copied transcript and the "forked session" sidebar label already promise. The parent's binding is untouched, so the parent continues unaffected. Backends without a fork flag see no behavior change. Documentation in docs/gateway/cli-backends.md describes the fork behavior.

Evidence

Three regression tests were added, one per fork path (buildForkedGatewaySessionEntry, forkSessionEntryFromParentTarget via the SQLite parent-fork accessor, and the sessions.create gateway method). Stock vs patched, with only the five source files swapped and the tests left in place:

$ node node_modules/vitest/vitest.mjs run \
    src/gateway/session-create-fork-entry.test.ts \
    src/config/sessions/session-accessor.parent-fork.test.ts \
    src/gateway/server.sessions.create.test.ts

# stock (source files at the base commit)
 × session-accessor.parent-fork.test.ts > branches the parent native CLI session into the forked child
 × session-create-fork-entry.test.ts > branches the parent native CLI sessions into the child with a one-shot fork resume
 × server.sessions.create.test.ts > sessions.create forks the parent transcript into the new session
 Test Files  3 failed (3)
      Tests  3 failed | 177 passed (180)

# patched
 Test Files  3 passed (3)
      Tests  180 passed (180)

The unit test also asserts the negative cases: a parent binding for a backend without a fork flag is not copied, a parent binding without a recorded checkpoint is not copied (the child starts fresh), the parent's reseedReceipt is dropped, stale cliSessionIds / claudeCliSessionId on a reused target are cleared, and the parent entry is not mutated.

Neighboring suites (src/config/sessions, src/gateway/session-create*, src/agents/cli-session*, src/agents/command/session-store*, src/agents/cli-backends*): 2038 passed, 2 failed. The 2 failures are in session-transcript-reconcile.lease.test.ts and fail identically on the base commit with this change reverted, so they are unrelated.

tsgo -p tsconfig.core.json --noEmit reports no errors in the changed files. oxlint, oxfmt --check, and the import-cycle check pass on the changed files.

A fourth regression test covers the live chat path (src/auto-reply/reply/agent-runner-execution-cli-admission.test.ts, "honors a forked child's one-shot fork marker on its first native resume"). Stock vs patched, with only agent-runner-cli-candidate.ts swapped and the test left in place:

# stock
 × agent-runner-execution-cli-admission.test.ts > honors a forked child's one-shot fork marker on its first native resume
   AssertionError: expected 'final' to be 'success'

# patched
 Test Files  4 passed (4)
      Tests  297 passed (297)

Account validation on the copied binding is covered in src/agents/cli-session.test.ts ("validates a forked binding against the child's account before resuming it"): the forked binding carries the parent's fingerprints and no forceReuse, and resolveCliSessionReuse returns invalidate with auth-profile / auth-epoch when the child's current profile or epoch differs, and reuse when they match. Fork suites after this change: 5 files, 241 tests passed.

Live proof against a running claude binary, on a throwaway gateway built from this branch (state dir and config isolated, claude-cli / claude-haiku-4-5, OPENCLAW_CLI_BACKEND_LOG_OUTPUT=1 to log the spawned argv). Procedure: send "The codeword is PELICAN-42" to a fresh parent session, fork it with sessions.create { parentSessionKey, fork: true }, then ask the child "What is the codeword?".

# stock (base commit f60e18360af, same test harness)
parent argv:  --session-id baab7621-2a55-44ff-b53d-ff885b1f173f
child argv:   --session-id 79bdabf0-0e7f-4dfc-9fdd-5938ca222760      # fresh, no --resume
child reply:  "I don't have a codeword to provide. This appears to be the start of a new session ..."
child native transcript: 0 mentions of PELICAN

# patched (this branch at the third commit)
parent argv:  --session-id 89deeed0-1798-4f6c-b185-f929d74ceff5
parent binding after its turn: sessionId=89deeed0-… resumeCheckpointId=b4e5f7d0-a19f-4d9c-b607-63d0bd8c01e2
child binding before turn:     sessionId=89deeed0-… resumeCheckpointId=b4e5f7d0-… forkNextResume=true (no forceReuse)
child argv:   --resume 89deeed0-1798-4f6c-b185-f929d74ceff5 --fork-session --resume-session-at b4e5f7d0-a19f-4d9c-b607-63d0bd8c01e2
child reply:  "PELICAN-42"
child binding after turn:      sessionId=49c9e2a9-42d0-4734-994d-a6bb2eab6456 (no forkNextResume)
parent binding after turn:     sessionId=89deeed0-… resumeCheckpointId=b4e5f7d0-… (unchanged)
native session files: 1 before, 2 after; the child's file contains the parent's turns up to b4e5f7d0-… and then its own
second child turn argv: --resume 49c9e2a9-42d0-4734-994d-a6bb2eab6456   (plain resume; binding then refreshes to resumeCheckpointId=953772f1-…)

Successor persistence (fourth commit). New test in src/agents/command/session-store.test.ts, "keeps account checks on the fork successor when the source was not force-reused": a source binding with authProfileId: "claude:work", authEpoch: "epoch-1", authEpochVersion: 3 and a checkpoint is claimed and the successor persisted; the stored binding is the source binding with only sessionId replaced and no forceReuse, in memory and after a fresh loadPersistedSessionEntry. Feeding that persisted binding to resolveCliSessionReuse with authProfileId: "claude:personal", authEpoch: "epoch-2" returns { mode: "invalidate", invalidatedReason: "auth-profile" }, so a credential change after successor persistence starts the child fresh instead of resuming the retained native context. With the previous writer the persisted binding carried forceReuse: true, which resolveCliSessionReuse honors before any fingerprint check. The existing successor assertions in attempt-execution.cli.test.ts and agent-runner-execution-cli-admission.test.ts now assert that forceReuse is absent on the persisted successor. Fork suites after this commit: 6 files, 345 tests passed.

Data model: no stored fields are added, removed, or renamed. forceReuse is still read and written where it was; the only change is that new fork-successor writes no longer add it. Existing store entries need no migration.

Live proof of the same build (throwaway gateway, same procedure as above):

parent binding after its turn: sessionId=84e00bce-d168-4eab-b7de-51ab962da00b resumeCheckpointId=aabee3a4-7a73-436b-adc8-28c903289916
child binding before turn:     sessionId=84e00bce-… resumeCheckpointId=aabee3a4-… forkNextResume=true (no forceReuse)
child argv:   --resume 84e00bce-d168-4eab-b7de-51ab962da00b --fork-session --resume-session-at aabee3a4-7a73-436b-adc8-28c903289916
child reply:  "PELICAN-42"
child binding after turn:      sessionId=26419f9c-9e87-4541-a0e7-688c85a5a041 resumeCheckpointId=aabee3a4-… authEpochVersion=7 + parent's cwd/MCP/prompt hashes, no forceReuse, no forkNextResume
parent binding after turn:     unchanged
native session files: 3 before, 4 after; the child's file (26419f9c-…) contains PELICAN-42
second child turn argv: --resume 26419f9c-9e87-4541-a0e7-688c85a5a041   (plain resume; binding refreshes to resumeCheckpointId=2f4f8ab4-…)

Typecheck boundary: tsc -p tsconfig.core.json --noEmit on this branch reports no errors in the changed files; the remaining output is declaration-portability noise (TS4094/TS2883) in unrelated test-support and package files (the checked-in tsgo runner was not usable in this symlinked checkout, so this was run with the bundled tsc).

An earlier revision of this branch (before the third commit) produced the same child reply with --resume <parent> --fork-session and no checkpoint pin, and the revision before that (entry construction fixed, live path not yet wired) spawned the child with --resume <parent> and no --fork-session, which is what motivated the shared helper.

Rebased onto current main (no conflicts remain).

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Sep 22, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:49 PM ET / 22:49 UTC (Revision 8).

ClawSweeper review

What this changes

Preserve checkpointed native CLI conversation context when creating whole-session forks, and share guarded child-session claiming, recovery, and persistence across command and live replies.

Merge readiness

✅ Ready for maintainer review

Keep open: the fix remains necessary on current main, the earlier account-validation and checkpoint concerns are resolved, and the published native-runtime evidence supports the repaired behavior. No blocking patch defect was found.

Priority: P2
Reviewed head: 989056f18ab145cc6a4769647104b4516d700671

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-supported repair with strong native proof and no remaining actionable review finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The authenticated Gateway trace and exact-head installed-Claude proof exercise native fork construction, admission, execution, and SQLite persistence, showing checkpoint recall, a distinct child ID, subsequent child resume, and an unchanged advanced parent. Synthetic model HTTP is disclosed. Existing binding shapes remain compatible, with persisted reload coverage and no migration needed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The authenticated Gateway trace and exact-head installed-Claude proof exercise native fork construction, admission, execution, and SQLite persistence, showing checkpoint recall, a distinct child ID, subsequent child resume, and an unchanged advanced parent. Synthetic model HTTP is disclosed. Existing binding shapes remain compatible, with persisted reload coverage and no migration needed.
Evidence reviewed 10 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced changes. Raw inspection confirmed that test merge 5204912d079a664f3522eaf83c008b97b385eab7 has parent 6335fb7 followed by the exact PR head; its relevant binding changes match the introduced patch.
Still necessary on main and latest release: Inspected the fork builder on fetched main ac85f6d and v2026.9.7: neither carries the parent’s CLI binding into the child. Main’s automatic parent-fork owner also lacks the introduced native-binding handoff. No merged fixing PR is established.
Checkpoint and account boundary: The new binding producer requires a saved checkpoint and backend fork support, removes forceReuse and the parent’s reseed receipt, and retains validation fingerprints. The unchanged preparation owner passes current account, auth epoch, cwd, and MCP facts to the reuse validator before native resume.
Findings None None.
Security None None.

How this fits together

OpenClaw stores the visible conversation separately from the native CLI session that holds the model’s context. Fork creation must carry both histories forward, while the execution owner validates the binding and saves the child’s distinct native session.

flowchart TD
  A[Parent conversation] --> B[Whole-session fork]
  B --> C[Copy visible transcript]
  B --> D[Check native fork capability and checkpoint]
  D --> E[Validate account and execution owner]
  E --> F[Branch native CLI session]
  F --> G[Save distinct child binding]
  C --> H[Child conversation]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +97, Tests +447, Docs +1. Total +545 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 8 144 47 +97
Tests 7 491 44 +447
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 636 91 +545

Review metrics

Metric Value Why it matters
Production versus regression coverage production +144/-47, net +97; tests +491/-44, net +447 The stated production growth supplies the missing creation/live handoff while consolidating existing callback logic.

Stored data model

Persistent data-model change detected: serialized state: src/agents/cli-session-store.ts, unknown-data-model-change: src/agents/cli-session-store.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Use the existing session owner to create checkpoint-pinned native children with independent IDs and normal account/environment validation.

Do we have a high-confidence way to reproduce the issue?

Yes: create a whole-session fork of a Claude CLI conversation and ask the child about a parent-only codeword. Current-main source lacks the native-binding handoff, and published before/after Gateway traces demonstrate the failure; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes: extending the existing binding and execution owners repairs both creation paths and the live caller without a parallel store or new configuration surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ac85f6dc13ab.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded native CLI fork-context defect without introducing configuration or broader product surface.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The authenticated Gateway trace and exact-head installed-Claude proof exercise native fork construction, admission, execution, and SQLite persistence, showing checkpoint recall, a distinct child ID, subsequent child resume, and an unchanged advanced parent. Synthetic model HTTP is disclosed. Existing binding shapes remain compatible, with persisted reload coverage and no migration needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The authenticated Gateway trace and exact-head installed-Claude proof exercise native fork construction, admission, execution, and SQLite persistence, showing checkpoint recall, a distinct child ID, subsequent child resume, and an unchanged advanced parent. Synthetic model HTTP is disclosed. Existing binding shapes remain compatible, with persisted reload coverage and no migration needed.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced changes. Raw inspection confirmed that test merge 5204912d079a664f3522eaf83c008b97b385eab7 has parent 6335fb7 followed by the exact PR head; its relevant binding changes match the introduced patch. (5204912d079a)
  • Still necessary on main and latest release: Inspected the fork builder on fetched main ac85f6d and v2026.9.7: neither carries the parent’s CLI binding into the child. Main’s automatic parent-fork owner also lacks the introduced native-binding handoff. No merged fixing PR is established. (src/gateway/session-create-fork-entry.ts:5, ac85f6dc13ab)
  • Checkpoint and account boundary: The new binding producer requires a saved checkpoint and backend fork support, removes forceReuse and the parent’s reseed receipt, and retains validation fingerprints. The unchanged preparation owner passes current account, auth epoch, cwd, and MCP facts to the reuse validator before native resume. (src/config/sessions/cli-session-binding.ts:114, 989056f18ab1)
  • Current authority at persistence: Both callers use the shared fork callbacks. Claims and successor writes combine current-owner validation with cancellation checks; restoration retains current-owner validation. The SQLite mutation owner calls the supplied guard immediately before writing, and bindings remain fenced by local session, lifecycle, writer, and expected native ID. (src/agents/cli-session-store.ts:144, 989056f18ab1)
  • Real behavior proof and complete body coverage: Read the full GitHub body and verified its SHA-256 matches captured source identity 7a338764e6f6fda12b84685c1717e1b134ff3ae4b679db0dedf59bead290c5a0. The contributor’s authenticated isolated Gateway trace shows public session creation, checkpoint-pinned native branching, a distinct child ID, subsequent plain child resume, and unchanged parent binding. Exact-head supplementary proof uses the actual fork builder, admission/execution and SQLite callbacks with installed Claude CLI 2.1.219 and synthetic model HTTP: a fresh child forgets the codeword, the pinned child remembers the earlier checkpoint after the parent advances, and unsupported-capability controls reject before spawn/model requests. These are published observations, not executions performed by this review. (989056f18ab1)
  • Existing-state compatibility: No stored fields or schema are introduced or removed. The successor writer preserves existing binding fields instead of newly adding forceReuse; an existing explicitly force-reused catalog binding still retains it. Regression coverage checks persisted successor reload and rejection after an account change. Existing rows require no rewrite or migration. (src/agents/cli-session-store.test.ts:481, 989056f18ab1)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed September 22, 2026, 4:49 AM ET / 08:49 UTC sha unknown :: needs real behavior proof before merge. :: [P1] Preserve account validation when arming an ordinary fork | [P2] Require a stable cutoff for checkpointless native bindings
  • reviewed 2026-09-22T12:47:12.625Z sha c89987153a9391b50bc8e66460d641911cb8d5b0 :: needs real behavior proof before merge. :: [P1] Preserve account validation when arming an ordinary fork | [P2] Require a stable cutoff for checkpointless native bindings
  • reviewed 2026-09-22T13:06:38.995Z sha b6d75d65ab3f03cf21af886b7fcbadc4f965d09a :: needs real behavior proof before merge. :: [P1] Preserve account checks when persisting an ordinary fork successor
  • reviewed 2026-09-22T15:44:26.936Z sha c3f3dfd30e9e6dd63c05606d91450065be3fc21d :: needs changes before merge. :: none
  • reviewed 2026-09-24T01:52:41.172Z sha 5868ee495df60e746894e5643c8fe8d9a35d5f59 :: needs changes before merge. :: none
  • reviewed 2026-09-27T01:59:35.271Z sha 5868ee495df60e746894e5643c8fe8d9a35d5f59 :: blocked before merge. :: none
  • reviewed 2026-10-01T22:33:03.527Z sha 989056f :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 22, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 22, 2026
@Marvinthebored
Marvinthebored force-pushed the fix/fork-keeps-claude-cli-session branch from c899871 to b6d75d6 Compare September 22, 2026 12:53
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Sep 22, 2026
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 22, 2026
@Marvinthebored
Marvinthebored force-pushed the fix/fork-keeps-claude-cli-session branch from c3f3dfd to 5868ee4 Compare September 24, 2026 01:46
@Patrick-Erichsen Patrick-Erichsen self-assigned this Oct 1, 2026
Carry checkpointed native context through whole-session forks and share
owner-bound claim, restore, and successor publication across CLI callers.

Co-authored-by: Marvinthebored <[email protected]>
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix/fork-keeps-claude-cli-session branch from 5868ee4 to 989056f Compare October 1, 2026 22:24
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Integrated the checkpointed native fork with current main's shared session owner, preserving @Marvinthebored's contribution. The repair also moves plugin preparation outside the SQLite transaction and fences cancelled or released claims/successor writes.

Paired regressions reproduce missing child bindings, unsupported checkpoint capability, plugin work inside BEGIN, and cancelled publication before the fix. Final validation: 317 focused/sibling tests, 95 final caller retests, the full changed-file gate (all 27 test type graphs, production types, Knip, lint/format, storage guards), and canonical P0 autoreview pass.

Fresh candidate proof uses the actual fork builder, admission/executor, SQLite callbacks, and installed Claude CLI 2.1.219 with a local deterministic API: fresh child forgets the codeword; pinned fork remembers the recorded parent checkpoint, receives a distinct native ID, resumes that ID next turn, and leaves the advanced parent unchanged. Both missing-capability controls reject before spawning and preserve the marker. Six native processes exit0. This is reviewer native-runtime proof, not authenticated cloud inference; the contributor's separate authenticated Gateway trace is preserved in the body.

The body includes per-file test time and available historical CI cost, addressing the latest Rank-up move. Production net+97 absorbs existing callback duplication and supplies the missing creation/live lifecycle boundaries; no schema/config/protocol additions. Root also directly inspected sibling Codex thread/fork source and the installed Claude flag contract. Public candidate989056f18ab145cc6a4769647104b4516d700671; final-head hosted build/CI and native landing checks remain required.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Required full build verification for 989056f18ab145cc6a4769647104b4516d700671:

  • pnpm build passed, exit 0, 446.515 seconds; Node 24.19.0 and pnpm 12.5.1 with frozen dependencies in an isolated source workspace and synthetic HOME.
  • Full profile completed all six core and both plugin SDK declaration invocations, runtime-postbuild validation, CLI bootstrap-import and SDK-export checks.
  • The emitted build-info commit matches the published head. All 21 pinned source/build-input hashes remained unchanged; build and bootstrap processes joined.
  • No ineffective dynamic-import warning references the changed Gateway/CLI modules. Three UI import warnings concern 13 modules byte-identical to base 8ae1e870c1ad684b32be61bd3d460e06deb083e5, with unchanged UI/build configuration. Named UI follow-up: consolidate mixed static/dynamic imports for session roster caching, snapshot invalidation, and composer draft persistence.

Build log SHA-256: f0ebacafa6eb061e18cd2e6c234976a3292c79cabdd6d3f9716c2fe9badefacc. This completes the build gate alongside the published paired native CLI and Gateway proof.

@Patrick-Erichsen
Patrick-Erichsen merged commit a85b58c into openclaw:main Oct 2, 2026
144 checks passed
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
Carry checkpointed native context through whole-session forks and share
owner-bound claim, restore, and successor publication across CLI callers.

Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forking a claude-cli conversation starts the child with an empty model context

2 participants