openclaw - 💡(How to fix) Fix Bug: Three `hasRealConversationContent` guards silently block compaction — `session.messages` arrives empty [1 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#60858Fetched 2026-04-08 02:46:23
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

Three independent guards check session.messages.some(hasRealConversationContent) or preparation.messagesToSummarize.some(isRealConversationMessage) and bail out with { ok: true, compacted: false, reason: "no real conversation messages" }. The filter functions themselves appear correct — the issue is that the message arrays arrive empty or unpopulated upstream, so every message fails the filter.

The three locations (line numbers from v2026.3.13 dist):

  1. dist/auth-profiles-DRjqKE3G.js ~line 97903 — plugin-side safeguard
  2. dist/auth-profiles-DDVivXkv.js ~line 102920 — core safeguard
  3. dist/plugin-sdk/thread-bindings-SYAnWHuW.js ~line 93957 — compactEmbeddedPiSessionDirect safeguard

Fix Action

Workaround

Commenting out all three return { ok: true, compacted: false } blocks allows compaction to proceed. After patching, auto-compaction fires and succeeds.

RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw 2026.3.13 (61d171a), Homebrew, macOS 15.6 arm64, Node 25.6.0
  • Plugin: @martian-engineering/lossless-claw v0.5.3 (contextThreshold: 0.75)
  • Agent model: anthropic/claude-opus-4-6 (200k ctx)
  • Channel: Telegram

Problem

Compaction never triggers despite context reaching 287% capacity (2.9M/1.0M tokens). The agent repeatedly resets the conversation with "Context limit exceeded" instead of compacting. Logs show: [compaction] skipping — no real conversation messages

Root cause

Three independent guards check session.messages.some(hasRealConversationContent) or preparation.messagesToSummarize.some(isRealConversationMessage) and bail out with { ok: true, compacted: false, reason: "no real conversation messages" }. The filter functions themselves appear correct — the issue is that the message arrays arrive empty or unpopulated upstream, so every message fails the filter.

The three locations (line numbers from v2026.3.13 dist):

  1. dist/auth-profiles-DRjqKE3G.js ~line 97903 — plugin-side safeguard
  2. dist/auth-profiles-DDVivXkv.js ~line 102920 — core safeguard
  3. dist/plugin-sdk/thread-bindings-SYAnWHuW.js ~line 93957 — compactEmbeddedPiSessionDirect safeguard

Workaround

Commenting out all three return { ok: true, compacted: false } blocks allows compaction to proceed. After patching, auto-compaction fires and succeeds.

Additional note

When using ollama/qwen2.5:7b as the lossless-claw summaryModel, the LLM sometimes responds with text containing "below threshold" even when context is well over capacity. The classifier at thread-bindings line 93489 (if (text.includes("below threshold")) return "below_threshold") then labels it as a skip, producing the misleading "Compaction skipped: already under target" message. Switching to anthropic/claude-haiku-4-5-20251001 resolved this. This may be worth noting in the lossless-claw docs as a model compatibility issue.

Steps to reproduce

  1. Install OpenClaw with lossless-claw plugin, contextThreshold: 0.75
  2. Use the agent via Telegram until context grows past threshold
  3. Observe [compaction] skipping — no real conversation messages in logs
  4. Context eventually exceeds limit and resets instead of compacting

Expected behavior

Compaction should trigger at the configured threshold without the guards blocking on empty message arrays.

extent analysis

TL;DR

Commenting out the three return { ok: true, compacted: false } blocks in the specified locations allows compaction to proceed, but a more robust solution would involve ensuring the message arrays are properly populated before the compaction checks.

Guidance

  • Investigate why the session.messages and preparation.messagesToSummarize arrays are arriving empty or unpopulated, as this is the root cause of the compaction not triggering.
  • Verify that the message filtering functions hasRealConversationContent and isRealConversationMessage are correctly implemented and not inadvertently causing the messages to be filtered out.
  • Consider adding logging or debugging statements to track the population of the message arrays and the execution flow of the compaction checks to better understand the issue.
  • Review the compatibility of the summaryModel used in the lossless-claw plugin, as the issue with "below threshold" responses may be related to the model used.

Example

No code snippet is provided as the issue is more related to the logic and data flow rather than a specific code syntax error.

Notes

The provided workaround of commenting out the return blocks may allow compaction to proceed but does not address the underlying issue of the empty message arrays. It's essential to investigate and resolve the root cause to ensure reliable operation.

Recommendation

Apply the workaround of commenting out the three return { ok: true, compacted: false } blocks as a temporary measure, but prioritize investigating and fixing the root cause of the empty message arrays to ensure proper compaction functionality.

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

Compaction should trigger at the configured threshold without the guards blocking on empty message arrays.

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: Three `hasRealConversationContent` guards silently block compaction — `session.messages` arrives empty [1 participants]