openclaw - 💡(How to fix) Fix [Bug]: Dynamic group context in stable system prompt causes stable-system-change resets, breaking claude-cli session continuity [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#84097Fetched 2026-05-20 03:44:07
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
1
Author
Timeline (top)
labeled ×2closed ×1commented ×1

When OpenClaw bots operate in a Feishu group chat with Claude CLI (tmux mode), every incoming @mention resets the claude-cli session to a fresh start instead of resuming the prior conversation. This kills multi-turn memory between mentions in the same group.

Root cause identified via session log analysis:

  1. OpenClaw builds a "stable" system prompt for the claude-cli session identity hash (hashCliSessionStablePrompt).
  2. For group chats, this stable system prompt includes [recent_group_context] — a snapshot of the last 20 messages in the group.
  3. Every new @mention arrives with updated group context (the new message is now part of the snapshot), causing the systemPromptHash to change.
  4. Claude CLI detects the hash mismatch and fires stable-system-change → launchMode=fresh, destroying the prior session and starting blank.

Observed in tmux diagnostic logs:

cli session reset: reason=stable-system-change
launchMode=fresh

Root Cause

recent_group_context (the last N messages of the group) is injected into the stable portion of the system prompt used for session identity. Because this snapshot changes every turn, the hash always changes.

Fix: move recent_group_context out of the stable system prompt portion and into a per-turn user message prefix instead. The stable hash would then only cover static agent configuration (persona, rules, tools), which stays constant across turns.

Code Example

cli session reset: reason=stable-system-change
launchMode=fresh
RAW_BUFFERClick to expand / collapse

Context

When OpenClaw bots operate in a Feishu group chat with Claude CLI (tmux mode), every incoming @mention resets the claude-cli session to a fresh start instead of resuming the prior conversation. This kills multi-turn memory between mentions in the same group.

Root cause identified via session log analysis:

  1. OpenClaw builds a "stable" system prompt for the claude-cli session identity hash (hashCliSessionStablePrompt).
  2. For group chats, this stable system prompt includes [recent_group_context] — a snapshot of the last 20 messages in the group.
  3. Every new @mention arrives with updated group context (the new message is now part of the snapshot), causing the systemPromptHash to change.
  4. Claude CLI detects the hash mismatch and fires stable-system-change → launchMode=fresh, destroying the prior session and starting blank.

Observed in tmux diagnostic logs:

cli session reset: reason=stable-system-change
launchMode=fresh

Steps To Reproduce

  1. Configure a Feishu group chat with a Claude CLI (tmux-mode) agent.
  2. Send @Cody message A — agent responds, session S1 is created.
  3. Send @Cody message B — session S2 is created fresh (S1 context lost).
  4. Inspect tmux runtime log: stable-system-change appears with each new @mention.

Actual Result

Each @mention spawns a brand-new claude-cli session. The agent has no memory of the previous turn in the same group chat.

Expected Result

The stable system prompt hash should remain constant across consecutive turns in the same group. The agent should resume the same claude-cli session and retain full conversation context.

Root Cause

recent_group_context (the last N messages of the group) is injected into the stable portion of the system prompt used for session identity. Because this snapshot changes every turn, the hash always changes.

Fix: move recent_group_context out of the stable system prompt portion and into a per-turn user message prefix instead. The stable hash would then only cover static agent configuration (persona, rules, tools), which stays constant across turns.

Acceptance Criteria

  • The systemPromptHash for a group chat session does not change between consecutive @mention turns (no new model/mcp/config changes).
  • stable-system-change is no longer emitted in logs for normal follow-up messages in the same group.
  • The agent correctly resumes the prior claude-cli session on follow-up @mentions in the same group.
  • Recent group context is still visible to the model each turn (injected as user message prefix).

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Dynamic group context in stable system prompt causes stable-system-change resets, breaking claude-cli session continuity [1 comments, 2 participants]