Skip to content

fix: keep failed Claude forks from resuming a missing conversation - #208548

Merged
daniel-lxs merged 2 commits into
mainfrom
openclaw/claude-fork-ghost-session-166917
Nov 29, 2026
Merged

daniel-lxs merged 2 commits into
mainfrom
openclaw/claude-fork-ghost-session-166917

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Collaborator

Related: #181254 and #192050.

What Problem This Solves

If the first action in a forked Claude Code chat is /compact and Claude rejects the inherited checkpoint, a second /compact says “No conversation found with session ID.” OpenClaw saved the ID from Claude’s first error even though there was no conversation to resume.

User Impact

A retry stays on the fork at its original checkpoint. If the checkpoint is still missing, Claude reports that same problem rather than looking for a nonexistent conversation. The parent is unchanged. This prevents new bad bindings; it does not restore a missing checkpoint or repair a previously saved ID.

Why This Change Was Made

Claude includes a session ID even in a terminal error reporting zero turns. The stream parser keeps that ID for diagnostics but does not announce it as a fork successor. An initialized child can still be saved as soon as it announces itself, preserving the crash recovery in #208048. The checkpoint classifier from #181308 is unchanged. #192050 concerns a different write: settlement after another writer clears or replaces a binding.

Evidence

I ran the same two sessions.compact calls through built Gateways on Crabbox AWS with real Claude Code 2.1.308. I seeded a synthetic parent whose recorded checkpoint was absent from its native transcript and forked it through sessions.create. Both runs checked Claude’s arguments and results against the child’s SQLite binding after each call. Neither required model inference.

Main: 4edf0cf Fix: fb72198
First rejection Saved the error ID d7c1ec6d… and cleared the fork flag. No transcript existed for that ID. Kept the original native ID, checkpoint and pending fork.
Second /compact Sent plain --resume d7c1ec6d…. Claude reported “No conversation found.” Retried --resume <parent> --fork-session --resume-session-at <checkpoint>. Claude rejected the same missing checkpoint.

The parent binding stayed unchanged on both revisions. The regression failed on main when the successor writer received the error ID. On the fixed head the regression and all five focused test files passed, along with the runtime build, core typecheck, scoped lint, and formatting. AWS checks. I tested the rejection, not the process that removed the checkpoint or a successful live-model compaction.

Second compaction, same scenario. These are terminal captures of the actual Gateway CLI response. Main targets the missing conversation; the fix reports the missing checkpoint instead.

Main

Main: no conversation found

Fix

Fix: the original checkpoint is still missing

The published head adds only the publication marker; its Git tree is identical to the tested fixed commit.

Reported and co-authored 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:42
Keep the ID from a zero-turn Claude error for diagnostics without reporting it as a resumable fork successor. An initialized session still publishes its ID immediately.

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

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 97a58aa0-b651-4c4b-8c36-23400ffec1d4
@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 agents Agent runtime and tooling size: XS labels Nov 29, 2026
@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 P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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 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 prevents a zero-turn Claude error from publishing a nonexistent conversation ID as a fork successor.

Example: A fork's first /compact fails because checkpoint 11111111-2222-3333-4444-555555555555 is missing.

  • Before: OpenClaw saves the error's session ID, so the second /compact tries that nonexistent conversation.
  • After: OpenClaw retains the parent ID, checkpoint, and pending fork, so the second /compact retries the original fork.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A worthwhile, minimal repair supported by production-entry-point captures and a focused executor regression; broad exact-head CI remained in progress.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Inspected terminal captures exercise sessions.compact through built Gateways with real Claude Code: the second call changes from a missing-conversation error to the original missing-checkpoint error. The self-contained evidence also reports preserved child fork metadata and unchanged parent bindings; linked run internals were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After a failed first compaction in a fork, retrying can target a Claude conversation that was never created.
Reason: The maintainer-authored direction restores documented fork continuity with no new configuration, public API, or state owner; repairing previously saved bad IDs is explicitly outside this focused prevention.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a current fork-continuity defect with a focused change and no actionable review findings.

Reviewed head: 3b1b7a913cc890cbd77f430c5724255914078b6e

Before merge

None.

Findings

None.

Agent review details

How this fits together

Claude CLI output enters the streaming parser, which separates diagnostic session IDs from successor notifications consumed by the existing durable session-binding writer.

flowchart TD
  A[Fork compaction request] --> B[CLI executor]
  B --> C[Claude Code]
  C --> D[Streaming parser]
  D --> E[Diagnostic output]
  D --> F[Successor notification]
  F --> G[Session binding writer]
Loading

Technical review

Best possible solution:

Keep diagnostic IDs in parser output while notifying the existing successor writer only when Claude has established a usable child session.

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

Current-main parsing and successor persistence establish the failure path, and the supplied paired Gateway captures show its user-visible result without requiring model inference.

Is this the best way to solve the issue?

The patch fixes the invalid notification at its producer using existing owners, preserves initialized-child publication, and leaves checkpoint selection and recovery classification intact.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Session-ID notification changes intended behavior with a stated reason (b7fa0f5: The inspected refactor centralized an existing notification path so lifecycle records could also carry session continuity; it does not establish the callback's earliest introduction.)
  • Checkpoint rejection classification regression keeps the original intent (751fc4c: Recognize the exact rejected checkpoint on process-exit and structured-result paths so existing bounded recovery can handle session invalidation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • RoboClaw: Raw commit b7fa0f5 adds src/agents/cli-output-stream.ts:263 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b7fa0f52c6a9; files: src/agents/cli-output-stream.ts)
  • mushuiyu886: Raw commit 751fc4c adds src/agents/cli-runner/execute.checkpoint-rejection.test.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 751fc4cc7297; files: src/agents/cli-runner/execute.checkpoint-rejection.test.ts)

PR surface

Source +8, Tests +5. Total +13 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 9 1 +8
Tests 1 7 2 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 16 3 +13

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:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • 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.

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.

Reviewed November 29, 2026, 2:54 PM ET / 19:54 UTC.

@daniel-lxs
daniel-lxs merged commit f122f56 into main Nov 29, 2026
143 checks passed
@daniel-lxs
daniel-lxs deleted the openclaw/claude-fork-ghost-session-166917 branch November 29, 2026 20:12
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…208548)

Keep the ID from a zero-turn Claude error for diagnostics without reporting it as a resumable fork successor. An initialized session still publishes its ID immediately.

Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 97a58aa0-b651-4c4b-8c36-23400ffec1d4
(cherry picked from commit f122f56)

Companion audit: 634d623 is not applicable: it observes Claude compaction summaries through a separate lifecycle callback, not session ID publication. No PR/SHA mentions.

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

Keep the ID from a zero-turn Claude error for diagnostics without reporting it as a resumable fork successor. An initialized session still publishes its ID immediately.

Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 97a58aa0-b651-4c4b-8c36-23400ffec1d4

(cherry picked from commit f122f56)

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

Keep the ID from a zero-turn Claude error for diagnostics without reporting it as a resumable fork successor. An initialized session still publishes its ID immediately.

Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 97a58aa0-b651-4c4b-8c36-23400ffec1d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. 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: XS 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