openclaw - 💡(How to fix) Fix [Bug]: claude-cli sessions lose all conversation history after auth-profile / auth-epoch invalidation (reseed fallback silently drops the transcript) [1 pull requests]

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…

Summary When OpenClaw cannot resume a native claude-cli session, it is supposed to "reseed" the conversation by injecting the prior OpenClaw transcript into a fresh CLI run (the Continue this conversation using the OpenClaw transcript below prompt). After an auth-profile or auth-epoch change — which is exactly what a billing lockout / disabledUntil on the anthropic:claude-cli profile produces — this reseed fallback returns an empty history. The fresh session then starts with zero prior context: the agent has no memory of the ongoing conversation, repeats itself, re-asks questions, and re-runs work. The full turn-by-turn history still exists on disk (in the Claude Code JSONL transcript) but OpenClaw never reads it back.

Expected behavior When a claude-cli session is invalidated for any reason, the fresh CLI run should be reseeded with the prior conversation history so continuity is preserved. An auth-profile rotation should not silently erase the user's conversation.

Actual behavior After an auth-profile / auth-epoch invalidation, the fresh session is seeded with no conversation history at all. Every subsequent turn behaves as if the conversation just started. The user sees the assistant "lose" hours/days of context with no error surfaced.

Root cause Three independent limits in src/agents/cli-runner/session-history.ts combine to drop the transcript:

auth-profile / auth-epoch reasons are excluded from raw-transcript reseed. resolveCliSessionReuse sets invalidatedReason to auth-profile / auth-epoch when the auth profile or auth epoch changes (src/agents/cli-runner/prepare.ts:319-329, src/agents/cli-runner/types.ts:103-105). In loadCliSessionReseedMessages, loadRawTail() only carries the raw transcript when the reason is in RAW_TRANSCRIPT_RESEED_ALLOWED_REASONS (session-history.ts:49-54) = {missing-transcript, system-prompt, mcp, session-expired}. auth-profile and auth-epoch are not in that set, so loadRawTail() returns [] (session-history.ts:336-349). With no compaction summary present, loadCliSessionReseedMessages returns [] entirely (session-history.ts:354-356), buildCliSessionHistoryPrompt then returns undefined (session-history.ts:153-155), and the fresh session gets no history prompt.

Raw-transcript reseed is opt-in. Even for allowed reasons, loadRawTail() only runs when backendResolved.config.reseedFromRawTranscriptWhenUncompacted === true (prepare.ts:447-448), which is off by default. An uncompacted session with reseed disabled also reseeds empty.

Hard size caps. When reseed does run, buildCliSessionHistoryPrompt truncates rendered history at MAX_CLI_SESSION_RESEED_HISTORY_CHARS = 12 KB (session-history.ts:19,148-151), and loadCliSessionEntries discards the whole file if it exceeds MAX_CLI_SESSION_HISTORY_FILE_BYTES = 5 MB (session-history.ts:17,229). A busy session blows past both, so even a "successful" reseed carries only a thin slice.

The missing guardrail: there is no fallback that reconstructs history from the Claude Code JSONL transcript (~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl), which holds every user + assistant turn and is the real source of continuity.

Error Message

After an auth-profile / auth-epoch invalidation, the fresh session is seeded with no conversation history at all. Every subsequent turn behaves as if the conversation just started. The user sees the assistant "lose" hours/days of context with no error surfaced. Trigger an auth-profile / auth-epoch change — e.g. a billing error that writes disabledUntil onto the anthropic:claude-cli profile, or rotate the auth profile. Trigger an auth-profile / auth-epoch change — e.g. a billing error that writes disabledUntil onto the anthropic:claude-cli profile, or rotate the auth profile. Trigger seen in practice: switching agentRuntime to pi caused a direct Anthropic billing error → disabledUntil on anthropic:claude-cli → auth-profile invalidation → reseed dropped the transcript across many subsequent sessions.

Root Cause

Root cause Three independent limits in src/agents/cli-runner/session-history.ts combine to drop the transcript:

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Summary When OpenClaw cannot resume a native claude-cli session, it is supposed to "reseed" the conversation by injecting the prior OpenClaw transcript into a fresh CLI run (the Continue this conversation using the OpenClaw transcript below prompt). After an auth-profile or auth-epoch change — which is exactly what a billing lockout / disabledUntil on the anthropic:claude-cli profile produces — this reseed fallback returns an empty history. The fresh session then starts with zero prior context: the agent has no memory of the ongoing conversation, repeats itself, re-asks questions, and re-runs work. The full turn-by-turn history still exists on disk (in the Claude Code JSONL transcript) but OpenClaw never reads it back.

Expected behavior When a claude-cli session is invalidated for any reason, the fresh CLI run should be reseeded with the prior conversation history so continuity is preserved. An auth-profile rotation should not silently erase the user's conversation.

Actual behavior After an auth-profile / auth-epoch invalidation, the fresh session is seeded with no conversation history at all. Every subsequent turn behaves as if the conversation just started. The user sees the assistant "lose" hours/days of context with no error surfaced.

Root cause Three independent limits in src/agents/cli-runner/session-history.ts combine to drop the transcript:

auth-profile / auth-epoch reasons are excluded from raw-transcript reseed. resolveCliSessionReuse sets invalidatedReason to auth-profile / auth-epoch when the auth profile or auth epoch changes (src/agents/cli-runner/prepare.ts:319-329, src/agents/cli-runner/types.ts:103-105). In loadCliSessionReseedMessages, loadRawTail() only carries the raw transcript when the reason is in RAW_TRANSCRIPT_RESEED_ALLOWED_REASONS (session-history.ts:49-54) = {missing-transcript, system-prompt, mcp, session-expired}. auth-profile and auth-epoch are not in that set, so loadRawTail() returns [] (session-history.ts:336-349). With no compaction summary present, loadCliSessionReseedMessages returns [] entirely (session-history.ts:354-356), buildCliSessionHistoryPrompt then returns undefined (session-history.ts:153-155), and the fresh session gets no history prompt.

Raw-transcript reseed is opt-in. Even for allowed reasons, loadRawTail() only runs when backendResolved.config.reseedFromRawTranscriptWhenUncompacted === true (prepare.ts:447-448), which is off by default. An uncompacted session with reseed disabled also reseeds empty.

Hard size caps. When reseed does run, buildCliSessionHistoryPrompt truncates rendered history at MAX_CLI_SESSION_RESEED_HISTORY_CHARS = 12 KB (session-history.ts:19,148-151), and loadCliSessionEntries discards the whole file if it exceeds MAX_CLI_SESSION_HISTORY_FILE_BYTES = 5 MB (session-history.ts:17,229). A busy session blows past both, so even a "successful" reseed carries only a thin slice.

The missing guardrail: there is no fallback that reconstructs history from the Claude Code JSONL transcript (~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl), which holds every user + assistant turn and is the real source of continuity.

Steps to reproduce

Run an OpenClaw agent on a claude-cli backend (Anthropic models routed through claude-cli). Hold a multi-turn conversation so the OpenClaw session has real history (and no recent compaction). Trigger an auth-profile / auth-epoch change — e.g. a billing error that writes disabledUntil onto the anthropic:claude-cli profile, or rotate the auth profile. Send the next message. Observed: the fresh CLI session starts with no prior context (buildCliSessionHistoryPrompt produced undefined); the assistant has amnesia. The complete history is still present in ~/.claude/projects/.../<uuid>.jsonl.

Expected behavior

Run an OpenClaw agent on a claude-cli backend (Anthropic models routed through claude-cli). Hold a multi-turn conversation so the OpenClaw session has real history (and no recent compaction). Trigger an auth-profile / auth-epoch change — e.g. a billing error that writes disabledUntil onto the anthropic:claude-cli profile, or rotate the auth profile. Send the next message. Observed: the fresh CLI session starts with no prior context (buildCliSessionHistoryPrompt produced undefined); the assistant has amnesia. The complete history is still present in ~/.claude/projects/.../<uuid>.jsonl.

Actual behavior

Suggested fix Allow auth-profile / auth-epoch to carry history. Either add them to RAW_TRANSCRIPT_RESEED_ALLOWED_REASONS (session-history.ts:49-54), or — if withholding the raw transcript across an auth change is a deliberate safety boundary — still reseed from a redacted/summarised transcript instead of dropping it entirely. Losing the whole conversation should never be the default outcome of an auth rotation. Reseed by default. Make raw-transcript reseed the default behaviour when uncompacted (invert / default-on reseedFromRawTranscriptWhenUncompacted), or fall back to it whenever no compaction summary exists. Raise / scale the caps. MAX_CLI_SESSION_RESEED_HISTORY_CHARS (12 KB) and MAX_CLI_SESSION_HISTORY_FILE_BYTES (5 MB) silently destroy continuity for normal-length sessions. At minimum, when truncating, prefer the most recent turns and surface a visible warning rather than dropping the file. Last-resort recovery from the Claude Code transcript. When the OpenClaw-side transcript is empty/oversized, reconstruct reseed history from the Claude Code JSONL (~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl) — it contains the authoritative turn-by-turn record.

OpenClaw version

v2026.5.20-beta.1

Operating system

WSL2 Ubuntu

Install method

No response

Model

Claude Opus 4-7

Provider / routing chain

openclaw

Additional provider/model setup details

Related issues #82040 — Telegram conversation context duplicates session history. Different layer (Telegram context block); this issue is the claude-cli reseed path losing history outright. Environment OpenClaw, claude-cli backend for Anthropic models Platform: WSL2 Ubuntu Trigger seen in practice: switching agentRuntime to pi caused a direct Anthropic billing error → disabledUntil on anthropic:claude-cli → auth-profile invalidation → reseed dropped the transcript across many subsequent sessions.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

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

Run an OpenClaw agent on a claude-cli backend (Anthropic models routed through claude-cli). Hold a multi-turn conversation so the OpenClaw session has real history (and no recent compaction). Trigger an auth-profile / auth-epoch change — e.g. a billing error that writes disabledUntil onto the anthropic:claude-cli profile, or rotate the auth profile. Send the next message. Observed: the fresh CLI session starts with no prior context (buildCliSessionHistoryPrompt produced undefined); the assistant has amnesia. The complete history is still present in ~/.claude/projects/.../<uuid>.jsonl.

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]: claude-cli sessions lose all conversation history after auth-profile / auth-epoch invalidation (reseed fallback silently drops the transcript) [1 pull requests]