openclaw - 💡(How to fix) Fix [Bug] Auto-compaction (threshold-based) never fires in embedded runner [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#68580Fetched 2026-04-19 15:09:58
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
RAW_BUFFERClick to expand / collapse

Bug Description

OpenClaw version: 2026.4.15 (041266a) Model context window: 200k tokens Config: agents.defaults.compaction.mode: safeguard

Auto-compaction with threshold-based triggering does not fire even when context significantly exceeds the threshold. This is a follow-up to issue #67473 which was reported 2 days ago but remains unfixed.

Steps to Reproduce

  1. Configure agents.defaults.compaction.mode: safeguard (default)
  2. Have a conversation session that grows beyond 60% context usage (~120k tokens)
  3. Observe that auto-compaction never triggers
  4. Context continues to grow until it hits the model hard limit

Expected Behavior

When context reaches ~60% of the model's context window (approximately 120k tokens), the safeguard mode should trigger automatic compaction to compress history into a summary, allowing the conversation to continue.

Actual Behavior

From session data:

  • Context reached 63% (126k/200k) - no auto-compaction fired
  • GitHub issue #67473 reports 118k threshold was exceeded with 14+ turns and still no auto-fire
  • Compaction only works when manually triggered via trigger-context-handler.ps1

Config

{ "agents": { "defaults": { "compaction": { "mode": "safeguard" } } } }

Related Issues

  • #67473 - [Bug] Auto-compaction (threshold-based) never fires in embedded runner
  • #57174 - Feature: Per-agent compaction configuration (thresholds, mode, reserveTokens)
  • #10073 - [Feature] Configurable compaction threshold (agents.defaults.compaction.threshold)

Request

  1. Fix the threshold-based auto-compaction in safeguard mode so it actually fires
  2. If this is by design, add a documented config key to allow users to control the trigger point

extent analysis

TL;DR

The safeguard mode's auto-compaction trigger may not be functioning as expected due to a potential issue with the threshold configuration or the compaction mechanism itself.

Guidance

  • Review the configuration for agents.defaults.compaction.threshold to ensure it is set correctly, as the current configuration only shows the mode but not the threshold value.
  • Check if there are any updates or patches available for OpenClaw version 2026.4.15 that may address the auto-compaction issue, considering it's a follow-up to issue #67473.
  • Investigate the implementation of the safeguard mode in the OpenClaw codebase to understand how the auto-compaction trigger is supposed to work and identify any potential bugs or inconsistencies.
  • Consider manually triggering compaction via trigger-context-handler.ps1 as a temporary workaround to prevent context from hitting the model's hard limit.

Example

No specific code snippet can be provided without access to the OpenClaw codebase, but reviewing the configuration and implementation of the safeguard mode and its auto-compaction trigger is crucial.

Notes

The issue seems to be related to a specific configuration and version of OpenClaw, and without more information about the codebase or updates, providing a definitive fix is challenging. The guidance provided is based on the information given in the issue description.

Recommendation

Apply workaround: Manually trigger compaction when necessary until a fix for the auto-compaction issue in safeguard mode is available, as this ensures the conversation context does not exceed the model's limits and cause errors.

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 [Bug] Auto-compaction (threshold-based) never fires in embedded runner [1 participants]