openclaw - 💡(How to fix) Fix augmentChatHistoryWithCliSessionImports: provider gate excludes Anthropic-routed sessions [2 comments, 3 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#75850Fetched 2026-05-02 05:29:02
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
2
Timeline (top)
commented ×2closed ×1

Root Cause

Root cause At the top of augmentChatHistoryWithCliSessionImports there's a provider-name gate that early-returns unless provider === 'claude-cli'. Anthropic-routed sessions report provider === 'anthropic' even when a CLI session is bound, so the import path is never reached.

Fix Action

Fix / Workaround

Symptom For sessions routed through Anthropic that also have an associated CLI session, chat.history silently misses turns that exist in the underlying CLI JSONL. The CLI session imports never get merged in.

Workaround We've been running a local runtime patch since 2026-04-30. Happy to PR.

RAW_BUFFERClick to expand / collapse

Symptom For sessions routed through Anthropic that also have an associated CLI session, chat.history silently misses turns that exist in the underlying CLI JSONL. The CLI session imports never get merged in.

Root cause At the top of augmentChatHistoryWithCliSessionImports there's a provider-name gate that early-returns unless provider === 'claude-cli'. Anthropic-routed sessions report provider === 'anthropic' even when a CLI session is bound, so the import path is never reached.

Suggested fix Drop or generalize the provider gate. The actual safety condition should be the presence of a CLI session reference on the session, not the provider string. Anything with a bound CLI session should get its imports merged regardless of which provider routed the turn.

Affected dist files

  • cli-session-history-*.js
  • chat-*.js

Workaround We've been running a local runtime patch since 2026-04-30. Happy to PR.

extent analysis

TL;DR

The issue can be fixed by modifying the augmentChatHistoryWithCliSessionImports function to remove or generalize the provider gate, allowing CLI session imports to be merged regardless of the provider.

Guidance

  • Identify the augmentChatHistoryWithCliSessionImports function and locate the provider gate at the top of the function.
  • Verify that the gate is causing the issue by checking if the provider variable is set to 'anthropic' when a CLI session is bound.
  • Modify the gate to check for the presence of a CLI session reference on the session instead of the provider string.
  • Test the modified function to ensure that CLI session imports are being merged correctly.

Example

// Before
if (provider === 'claude-cli') {
  // merge imports
}

// After
if (session.cliSessionReference) {
  // merge imports
}

Notes

The suggested fix assumes that the session.cliSessionReference property is a reliable indicator of a bound CLI session. If this property is not always present or accurate, additional modifications may be needed.

Recommendation

Apply the workaround by modifying the augmentChatHistoryWithCliSessionImports function to remove or generalize the provider gate, as this is a targeted fix that addresses the root cause of the issue.

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 augmentChatHistoryWithCliSessionImports: provider gate excludes Anthropic-routed sessions [2 comments, 3 participants]