Skip to content

fix: keep the latest Claude summary when forking after compaction - #208535

Merged
daniel-lxs merged 9 commits into
mainfrom
openclaw/claude-fork-stale-checkpoint-d0d96e
Nov 29, 2026
Merged

daniel-lxs merged 9 commits into
mainfrom
openclaw/claude-fork-stale-checkpoint-d0d96e

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #181254.

What problem this solves

After two consecutive /compact commands in a Claude CLI chat, a full fork could retain an assistant message UUID that Claude had compacted away. Running /compact as the fork’s first action then failed with No message found with message.uuid.

What changes

A full fork uses the latest summary recorded by Claude. When the child contains only that summary, its first /compact reports that there are too few messages to compact. An ordinary message continues in the same child, and a later /compact updates the child’s own summary. The parent keeps its own transcript and checkpoint. Existing forks keep the checkpoint recorded at creation.

The Claude adapter reads the summary UUID from the JSONL stream, including summaries that extend beyond the raw stdout capture. An acknowledgement alone keeps the existing checkpoint. An observed Claude compaction boundary invalidates the old checkpoint when Claude supplies no usable summary UUID. The native session binding is updated only when that backend reports a replacement or invalidates the old checkpoint.

Pinning matters because the parent can advance after a fork. The fork still checks the selected Claude account before compaction and keeps the pending fork when Claude rejects the checkpoint before starting a turn. Checkpointed retries · Full forks · Child compaction · Account check · Rejected fork

Verification

I ran fresh AWS Gateways with Claude Code 2.1.332. A loopback Messages endpoint supplied deterministic model replies. Claude Code handled the fork, resume, compaction and native transcript writes.

Main b943a89 PR e68b1e1
First /compact in the full fork Claude rejected the exact assistant UUID copied from the parent. Claude received the second parent summary’s UUID. The child skipped compaction and kept its count and summary.
Follow-up in the child The control ended at the rejected checkpoint. The model request contained the second summary’s unique marker. The next /compact created a new summary in the same child and advanced its count once.
Parent Native and OpenClaw transcript hashes stayed fixed through the rejection. Both hashes stayed fixed through the skip, follow-up and later compaction.

Main AWS run · Final PR AWS run

190 focused tests passed across 9 files. The regressions cover acknowledgement-only backends, control-only JSONL acknowledgements, provider-specific skip reasons, and summaries beyond the raw stdout capture. The runtime build, core and extension typechecks, and scoped lint passed. Anthropic account sign-in and billing were outside this run.

Main Fixed
Claude rejects the stale checkpoint in the fork The fork reports that it has too few messages to compact

Reported by @daniel-lxs.

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

🦞 Made with OpenClaw

roboclaw-bot and others added 2 commits November 29, 2026 19:17
Keep the native summary checkpoint on the session whose transcript was compacted. A checkpoint at the boundary itself omits the summary; an earlier assistant UUID can no longer be resumed.

Co-authored-by: daniel-lxs <[email protected]>
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 64b65588-420a-42fa-b160-ca02987118bf
@clawsweeper

clawsweeper Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: anthropic size: S labels Nov 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels Nov 29, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 29, 2026 19:28
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 29, 2026
@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR records Claude’s latest compaction summary checkpoint so subsequent forks can resume usable native history.

Example: Run /compact twice in a Claude CLI chat, fork the conversation, then run /compact in the child.

  • Before: Claude rejects the inherited assistant checkpoint with “No message found with message.uuid”.
  • After: The child starts from the latest summary and reports “Not enough messages to compact”; its next ordinary message can continue.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused continuity repair with relevant production-path evidence and distinct regression coverage; live Anthropic authentication and billing were outside the supplied run.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected screenshots show the Gateway failure and corrected skip; the public paired-run account describes real Claude Code handling checkpoint selection, child continuation, later compaction, and parent preservation with deterministic model replies, and the reviewed production code matches that tested head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A newly forked Claude chat can fail its first compaction because its inherited checkpoint was removed by earlier parent compaction.
Reason: This restores documented native fork continuity; the maintainer-authored direction preserves account boundaries and existing fork checkpoints.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR addresses a distinct Claude fork continuity bug still present on main, and no blocking defect was found in the pinned diff.

Reviewed head: e68b1e1f3a0e3c3466ab854829a67ffb559094a1

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Anthropic adapter interprets Claude Code JSONL output, the shared CLI runner returns continuity metadata, and the session-store owner persists the checkpoint used when creating native forks.

flowchart LR
  A[Chat compaction request] --> B[Native CLI compaction owner]
  B --> C[Claude Code process]
  C --> D[Anthropic JSONL validator]
  D --> E[CLI result settlement]
  E --> F[Session binding store]
  F --> G[Checkpointed child fork]
Loading

Technical review

Best possible solution:

Keep summary interpretation in the Anthropic adapter and persist its checkpoint through the existing session-binding owner without changing already-pinned forks.

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

The paired Gateway screenshots show the reported failure, and current-main source confirms that manual compaction does not publish the replacement summary checkpoint; this review executed no target code.

Is this the best way to solve the issue?

The approach repairs checkpoint production at the provider boundary, preserves existing fork pinning, and handles bounded output without introducing another persistence owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Native manual CLI compaction validation keeps the original intent (f5c46de: Allow subscription-backed Claude sessions to compact natively without generic API-key preparation, requiring positive backend acknowledgement.)
  • Checkpoint-pinned native forks keeps the original intent (a85b58c: Preserve parent context at the selected fork point while assigning subsequent native writes to a distinct child.)
  • Native compaction accounting keeps the original intent (52d807b: Use Claude’s completed compaction boundary as the owner of compaction counts and token sizes.)
  • Preserved CLI binding settlement keeps the original intent (4a2a4e0: Acknowledge transcript input only in the native session actually resumed.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +118, Tests +132, Docs +8, Other 0. Total +258 across 23 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 15 178 60 +118
Tests 5 135 3 +132
Docs 2 9 1 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 23 323 65 +258

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • merge-risk: 🚨 compatibility: The public CLI backend compaction contract gains optional streaming validation and checkpoint outcomes; existing acknowledgement-only implementations remain supported, and the maintainer-authored PR establishes direction.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-29T19:35:43.324Z sha e81058f :: passed. :: none
  • reviewed 2026-11-29T21:02:51.501Z sha 33bfa80 :: passed. :: none

Reviewed November 29, 2026, 4:20 PM ET / 21:20 UTC (Revision 3).

@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@daniel-lxs
daniel-lxs merged commit 634d623 into main Nov 29, 2026
155 checks passed
@daniel-lxs
daniel-lxs deleted the openclaw/claude-fork-stale-checkpoint-d0d96e branch November 29, 2026 21:43
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…08535)

(cherry picked from commit 634d623)

Release adaptation: Read positive checkpoint evidence from bounded Claude native-compaction stdout and publish through the exact stable session writer fence; no SDK or schema change.

Companion audit: No pinned source-reference companion identified. Stable fork successor and account/auth fences are preserved.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* fix: show Claude CLI document uploads only once in chat

* fix: show Claude CLI document uploads only once in chat

OpenClaw-Publication: 4555cb04-bff2-43b3-aff8-ec271d6567b2

* fix: keep Claude document uploads on the message that sent them

* fix: preserve the released message queue result contract

Release adaptation: Use an optional accepted-input observer instead of widening
queueMessage's released Promise<void> contract. Reuse the stable steering and
transcript-rewrite handlers; leave source admission, native image steering,
config, and all SQLite schemas unchanged. The existing history index columns
also carry exact document correlation. Keep the released model-hook test layout.

Companion audit through be407a4: no later #203866 reference. PRs #208535
(Claude compacted fork summaries), #206158 (native subagent status), and
#205663 (image dimensions) are separate. PRs #208252 (Codex source), #207022
(embedded prompt dispatch), #206969 (fallback), #205963 (Copilot question
policy), and 50a7368 (snooze) do not own this path. SHA mentions in
#204700 and #204685 are update/qualification records, not follow-ups.

(cherry picked from commit 269f884)

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
Check the selected Claude account against the saved native session before manual compaction, including after a restart. A fork can compact on its selected account after its first ordinary turn establishes a native session there.

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 34da9584-a62a-4ed5-8cf3-a0b3e6387e25
OpenClaw-Publication: 4527fb28-07bf-43c1-854e-e4a27bd33b16

(cherry picked from commit d680722)

Release adaptation: Keep the stable compaction target and System admission. Compare the selected Claude credential with the persisted binding before CLI launch; preserve session-entry identity while publishing diff metadata. Retain stable auto-pin and missing-profile tests, add inherited and persisted-successor regressions, and verify slash/RPC account forwarding.

Companion audit: 634d623 (#208535) refreshes the checkpoint after successful compaction; it is not required for rejecting an account mismatch before launch and is handled by the separate w4-14 port (e2fe56f3019). No other referenced follow-up through the pinned scan end.

Release adaptation: Integration conflict with 5297bb2 (#208535, preserve latest Claude summary when forking after compaction) resolved by retaining checkpoint publication and importing the account-mismatch guard, which runs before CLI launch.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
Check the selected Claude account against the saved native session before manual compaction, including after a restart. A fork can compact on its selected account after its first ordinary turn establishes a native session there.

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 34da9584-a62a-4ed5-8cf3-a0b3e6387e25
OpenClaw-Publication: 4527fb28-07bf-43c1-854e-e4a27bd33b16

(cherry picked from commit d680722)

Release adaptation: Keep the beta release’s existing System admission wrapper and CLI target plumbing. Forward the session pin separately from the native binding, and add only the auth epoch import needed by the regressions. #208535 separately follows in lane order.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…08535)

Record Claude's post-compaction summary as the checkpoint for new forks. Preserve the existing checkpoint when a backend only acknowledges compaction, and keep subsequent child turns on their native session.

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 64b65588-420a-42fa-b160-ca02987118bf

(cherry picked from commit 634d623)

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
…enclaw#208535)

Record Claude's post-compaction summary as the checkpoint for new forks. Preserve the existing checkpoint when a backend only acknowledges compaction, and keep subsequent child turns on their native session.

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 64b65588-420a-42fa-b160-ca02987118bf
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 extensions: anthropic gateway Gateway runtime impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

2 participants