Skip to content

Bug: Three hasRealConversationContent guards silently block compaction — session.messages arrives empty #60858

Description

@whe17ch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions