-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: systemPromptHash in buildClaudeLiveFingerprint causes phantom claude-cli session restarts on every turn for chat channels #81041
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
[Bug]:
systemPromptHashinbuildClaudeLiveFingerprintcauses phantom claude-cli session restarts on every turn for chat channelsSummary
When OpenClaw routes a chat channel (Telegram, Discord, Slack, iMessage, Signal, WhatsApp) through the
claude-clibackend, the live-session fingerprint computed bybuildClaudeLiveFingerprint(insrc/agents/cli-runner/claude-live-session.ts) hashes the entire system prompt, including the per-turn volatile sections that OpenClaw injects on every inbound message:[Tue 2026-05-12 09:33 EDT], message_id, sender envelope)Every turn's prompt has a different hash → fingerprint diverges → the runtime decides the live claude-cli subprocess no longer matches the requested session and rotates to a fresh CLI subprocess. The new subprocess has no memory of the previous turn, so the agent loses context between adjacent messages from the same user in the same chat session.
This is claude-cli-only: the API backend (Anthropic Messages, OpenAI, OpenRouter) replays full message history per request and does not maintain a fingerprinted persistent process, so this code path doesn't apply.
Symptom (user-facing)
The agent has no recollection of its own message from 6 minutes earlier. Looks like
amnesia from the user's perspective. Reproduces consistently on Telegram/Discord; likely
all chat channels that inject any per-turn metadata.
Why it happens
src/agents/cli-runner/claude-live-session.tsline 276:params.context.systemPromptcontains everything OpenClaw assembles for the turn,including
inbound_meta, channel section ("Group Chat Context", "Reactions"), heartbeattext, sender allowlist, current date/time, and the runtime banner. Most of those are
intentionally per-turn-volatile (that's their whole purpose).
The fingerprint already separately hashes
extraSystemPromptHash(which catches staticconfig changes — the agent's persona prompt, SOUL.md, USER.md, AGENTS.md), so dropping
systemPromptHashdoes not weaken the integrity check. It just removes the per-turnvolatile component that should never have been part of the stability decision in the
first place.
Suggested fix
Remove the
systemPromptHashfield frombuildClaudeLiveFingerprint's output. Diff:workspaceDirHash: sha256(params.context.workspaceDir), provider: params.context.params.provider, model: params.context.normalizedModel, - systemPromptHash: sha256(params.context.systemPrompt), authProfileIdHash: …, authEpochHash: …, extraSystemPromptHash: params.context.extraSystemPromptHash,extraSystemPromptHashalready covers the static-config side of the check.Repro
claude-clibackend (Claude Max subscription — see lodekeeper's gist on migrating from API to claude-cli).prior turn.
Affected versions
Confirmed on 2026.5.7 (current latest at filing time). Code path appears to have existed
since the live-session fingerprint was introduced; likely affects every release with
buildClaudeLiveFingerprint.Scope
claude-clibackend + chat channels with per-turn metadata injection.Telegram and Discord confirmed; Slack/iMessage/Signal/WhatsApp/Mattermost likely.
Bedrock, etc.) — they don't keep a fingerprinted persistent process.
openclaw run) — those don't have themulti-turn context-loss symptom even when running through claude-cli.
Related issues
openclaw updaterun mid-turn causes total message loss on Telegram (and likely Discord) #71178 (openclaw updatemid-turn message loss on Telegram) — describesreason=system-promptresets, which is downstream of this same fingerprint check.path; may share root cause depending on how the delivery mirror reads transcript.
Workaround
Locally patching the bundled JS to drop
systemPromptHashfrom the fingerprint outputresolves the symptom. Tested on 2026.5.7 with Telegram + claude-cli; cross-turn context
is retained as expected after the change.
Next step
A PR with the source-level fix and tests will follow shortly.