openclaw - ✅(Solved) Fix `/compact` skips with "no real conversation messages yet" when the session runs under a CLI provider (claude-cli) [1 pull requests, 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#70304Fetched 2026-04-23 07:26:31
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Author
Timeline (top)
commented ×2cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #68388: fix(cli-backend): restore compaction lifecycle and rotate claude-cli sessions after compaction

Description (problem / solution / changelog)

Summary

Fixes #68329 — CLI-backed sessions skipped both pre-turn native compaction checks and post-turn context-engine/plugin maintenance, so context grew unbounded. For claude-cli specifically, compacting only OpenClaw's local transcript was not enough: Claude Code maintains its own resumed session history on disk, so the next turn re-loaded the pre-compaction context.

This PR:

  • Runs the pre-turn native compaction lifecycle for CLI-backed runs.
  • Runs post-turn context-engine / plugin maintenance for CLI-backed runs.
  • Rotates Claude CLI sessions after compaction by seeding a new resumed session JSONL from the compacted transcript history and using the new session id for subsequent turns.
  • Falls back to a prompt-based reseed if Claude seeded-session creation fails, so the turn still proceeds with compacted context.

Files changed

  • src/agents/cli-runner.ts
  • src/agents/cli-runner/execute.ts
  • src/agents/cli-runner/types.ts
  • src/agents/cli-runner/prepare.ts
  • src/agents/command/attempt-execution.ts
  • src/agents/agent-command.ts
  • src/agents/cli-runner.compaction.test.ts (new)
  • src/agents/command/attempt-execution.cli.test.ts
  • src/commands/agent.test.ts

Validation

Run locally on the patched checkout:

  • pnpm exec vitest run src/agents/command/attempt-execution.cli.test.ts src/agents/cli-runner.compaction.test.ts src/commands/agent.test.tspassed
  • NODE_OPTIONS=--max-old-space-size=8192 pnpm exec tsc -p tsconfig.json --noEmitpassed

Test plan

  • CI green on the PR
  • Manual verification: long-running CLI-backed session now triggers compaction and subsequent turns resume against the rotated Claude CLI session id
  • Verify prompt-based reseed path when seeded-session creation is forced to fail

Closes #68329

Changed files

  • src/agents/agent-command.ts (modified, +57/-0)
  • src/agents/cli-runner.compaction.test.ts (added, +283/-0)
  • src/agents/cli-runner.ts (modified, +469/-1)
  • src/agents/cli-runner/execute.ts (modified, +3/-2)
  • src/agents/cli-runner/prepare.ts (modified, +4/-1)
  • src/agents/cli-runner/types.ts (modified, +7/-0)
  • src/agents/command/attempt-execution.cli.test.ts (modified, +3/-0)
  • src/agents/command/attempt-execution.ts (modified, +24/-0)
  • src/commands/agent.test.ts (modified, +69/-0)

Code Example

⚙️ Compaction skipped: no real conversation messages yet • Context X/X (x%)
RAW_BUFFERClick to expand / collapse

On OpenClaw 2026.4.21, sending /compact from a Telegram direct chat whose session is backed by the claude-cli provider always responds with:

⚙️ Compaction skipped: no real conversation messages yet • Context X/X (x%)

However, this context can be wildly high

extent analysis

TL;DR

The issue might be resolved by checking the conversation history and ensuring that there are actual conversation messages, as the error message suggests that compaction is skipped due to a lack of real conversation messages.

Guidance

  • Verify that the conversation has actual messages by checking the chat history, as the error message implies that the compaction is skipped due to the absence of real conversation messages.
  • Investigate why the context percentage is wildly high despite the lack of conversation messages, as this might indicate an issue with the claude-cli provider or the conversation tracking mechanism.
  • Check the documentation of the claude-cli provider to see if there are any specific requirements or settings for conversation messages to be considered "real" and eligible for compaction.
  • Consider testing the /compact command in a different chat or with a different provider to isolate the issue and determine if it's specific to the claude-cli provider or the Telegram direct chat.

Notes

The issue seems to be specific to the claude-cli provider and the Telegram direct chat, so any solution or workaround might need to be tailored to this specific setup. Additionally, without more information about the claude-cli provider and its configuration, it's difficult to provide a more specific fix.

Recommendation

Apply workaround: The issue seems to be related to the claude-cli provider and the conversation tracking mechanism, so applying a workaround such as manually checking the conversation history or using a different provider might be necessary until a more permanent fix is available.

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