openclaw - 💡(How to fix) Fix [Bug]: claude-cli session binding invalidated after sessions_spawn, parent loses conversation history on every subagent flow [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#81460Fetched 2026-05-14 03:31:58
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1mentioned ×1

On claude-cli backend, every sessions_spawn flow forks the parent's claude-cli session, leaving the parent's accumulated conversation history orphaned on disk. Multi-agent workflows on claude-cli runtime become unusable: every subagent spawn erases the parent's continuity, the parent then operates from a fresh CLI session with no memory of prior turns.

Same extraSystemPromptHash drift mechanism described in #69118 (groupIntro trigger), but the subagent_announce delivery is a higher-impact trigger that affects every multi-agent orchestration pattern, not just group chat.

Root Cause

The binding's extraSystemPromptHash is recomputed on every invocation and compared to the stored value. When the parent processes the subagent_announce, the assistant context wrapper changes the assembled extraSystemPromptParts (the announce envelope is inter-session content, not part of the parent's prior turns). The hash bumps, the binding is treated as stale, a fresh CLI session is started.

Companion bug to #69118 (same mechanism, different trigger: groupIntro drift). The proposed comparator-tolerance fix discussed there would likely address this case too, but the announce-delivery overlay is a sharper signal that the hash should ignore transient injected context entirely.

Code Example

16:09  4933dfe2  (8 KB, fresh, received the announce)
16:23  ef8c3930  (8.8 KB, fresh)
16:30  28f770cb  (34 KB, current binding)
RAW_BUFFERClick to expand / collapse

Summary

On claude-cli backend, every sessions_spawn flow forks the parent's claude-cli session, leaving the parent's accumulated conversation history orphaned on disk. Multi-agent workflows on claude-cli runtime become unusable: every subagent spawn erases the parent's continuity, the parent then operates from a fresh CLI session with no memory of prior turns.

Same extraSystemPromptHash drift mechanism described in #69118 (groupIntro trigger), but the subagent_announce delivery is a higher-impact trigger that affects every multi-agent orchestration pattern, not just group chat.

Steps to reproduce

  1. Configure an agent on claude-cli backend with agentRuntime.id = "claude-cli". Use it normally until the session has accumulated meaningful history (a few hundred entries).
  2. From that agent's session, call sessions_spawn (any task, cleanup: "delete", agentId unset for self-spawn).
  3. Subagent runs and completes. subagent_announce delivers result back to parent.
  4. Inspect agents/<agentId>/sessions/sessions.json and ~/.claude/projects/-home-node--openclaw-workspace[-<agentId>]/.

Expected behavior

Parent's claude-cli session is resumed across the announce delivery. The bound cliSessionBindings.claude-cli.sessionId continues to point at the same session jsonl. Conversation history is intact.

Actual behavior

Parent's cliSessionBindings.claude-cli.sessionId rotates to a new session ID. The previous session jsonl remains on disk but is orphaned (no resume pointer points to it). Subsequent invocations create yet more fresh sessions on every turn that follows.

Observed in our setup: three claude-cli session forks in 21 minutes after a single subagent spawn:

16:09  4933dfe2  (8 KB, fresh, received the announce)
16:23  ef8c3930  (8.8 KB, fresh)
16:30  28f770cb  (34 KB, current binding)

Original session (55c431d6, 906 entries, 775 KB) remains on disk, no longer bound.

Gateway log emits the same reason=system-prompt reset code as in #69118.

Root cause analysis

The binding's extraSystemPromptHash is recomputed on every invocation and compared to the stored value. When the parent processes the subagent_announce, the assistant context wrapper changes the assembled extraSystemPromptParts (the announce envelope is inter-session content, not part of the parent's prior turns). The hash bumps, the binding is treated as stale, a fresh CLI session is started.

Companion bug to #69118 (same mechanism, different trigger: groupIntro drift). The proposed comparator-tolerance fix discussed there would likely address this case too, but the announce-delivery overlay is a sharper signal that the hash should ignore transient injected context entirely.

Cross-runtime control

Tested the identical subagent flow on a pi runtime agent (openai-codex/gpt-5.5). Pi-runtime parent kept its continuous session, no fork, no history loss. Confirms the bug is in the claude-cli binding-hash path, not in the subagent flow generically.

Impact

For multi-agent workflows on claude-cli runtime: every subagent spawn destroys the parent's continuity. The destructive UX masquerades as "the agent has amnesia." Production agents accumulating long conversation history are at the highest risk because the orphaned session contains the most context.

OpenClaw version

2026.5.7

Operating system

Ubuntu 24.04 LTS, Docker compose deployment

Install method

openclaw-custom:2026.5.7 Docker image

Model

anthropic/claude-opus-4-7 (parent) and anthropic/claude-sonnet-4-6 (parent), both via claude-cli runtime. Subagents inherited the parent's runtime and model (the missing-model-defaults part is a separate concern, reported as a comment on #81395).

Notes for fix scope

If the comparator-tolerance fix in #69118 is broadened to cover post-spawn announce overlays, this case is covered. Otherwise the fix needs to treat any inter-session-message content as transient (not part of the binding identity).

Happy to provide full session-store dumps, jsonl excerpts, or sessions.json entries on request.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Parent's claude-cli session is resumed across the announce delivery. The bound cliSessionBindings.claude-cli.sessionId continues to point at the same session jsonl. Conversation history is intact.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING