openclaw - 💡(How to fix) Fix [Bug]: Auto-compaction not triggering during tool-use loops — regression on 2026.4.11 [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#69838Fetched 2026-04-22 07:47:41
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Reproducing consistently on 2026.4.11 in sessions with large build/deploy workflows (15-30+ consecutive tool calls: exec, read, write, edit).

Previously reported in: #24800, #5433 — both closed, appears to be a regression.

Error Message

Compaction fires proactively when context approaches the limit (e.g. at contextWindow - reserveTokensFloor), before the API returns an overflow error.

Root Cause

Previously reported in #24800 and #5433, both closed. Appears to be a regression in 2026.4.11. Workaround: setting reserveTokensFloor: 20000 reduces severity but does not fix the root cause (reactive vs proactive check in run.ts).

Fix Action

Fix / Workaround

compaction.mode: safeguard reserveTokensFloor: unset initially, set to 20000 as workaround compaction.model: anthropic/claude-sonnet-4-6 compaction.memoryFlush.enabled: true

Previously reported in #24800 and #5433, both closed. Appears to be a regression in 2026.4.11. Workaround: setting reserveTokensFloor: 20000 reduces severity but does not fix the root cause (reactive vs proactive check in run.ts).

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Reproducing consistently on 2026.4.11 in sessions with large build/deploy workflows (15-30+ consecutive tool calls: exec, read, write, edit).

Previously reported in: #24800, #5433 — both closed, appears to be a regression.

Steps to reproduce

Start a fresh OpenClaw session with compaction.mode: safeguard and anthropic/claude-sonnet-4-6 as primary model Run a heavy build/deploy workflow involving 15-30+ consecutive tool calls (exec, read, write, edit) without user messages between them Monitor context via /status or session_status tool Observe context climbing past 100% of model limit with Compactions: 0

Expected behavior

Compaction fires proactively when context approaches the limit (e.g. at contextWindow - reserveTokensFloor), before the API returns an overflow error.

Actual behavior

Compaction never triggers during tool-use loops. Context grew from ~150k to 287k (143% over the 200k limit) with zero compactions. Manual wake event partially resolved it but auto-compaction never fired on its own.

OpenClaw version

2026.4.11

Operating system

macOS 15.2 (Darwin 25.2.0, arm64)

Install method

No response

Model

anthropic/claude-sonnet-4-6

Provider / routing chain

anthropic plugin, direct API key (no proxy)

Additional provider/model setup details

compaction.mode: safeguard reserveTokensFloor: unset initially, set to 20000 as workaround compaction.model: anthropic/claude-sonnet-4-6 compaction.memoryFlush.enabled: true

Logs, screenshots, and evidence

Impact and severity

High — heavy tool-use sessions (build/deploy workflows) become progressively slower and eventually require a manual session reset. Affects any workflow with sustained tool-use loops.

Additional information

Previously reported in #24800 and #5433, both closed. Appears to be a regression in 2026.4.11. Workaround: setting reserveTokensFloor: 20000 reduces severity but does not fix the root cause (reactive vs proactive check in run.ts).

extent analysis

TL;DR

Setting reserveTokensFloor to a suitable value may help mitigate the issue, but a more proactive compaction trigger is needed to fully resolve the problem.

Guidance

  • Review the compaction.mode: safeguard configuration and consider adjusting the reserveTokensFloor value to a more suitable threshold for the specific workflow.
  • Investigate the run.ts file to understand the reactive vs proactive check and how it can be modified to trigger compactions more proactively.
  • Monitor the context growth and compaction behavior with different reserveTokensFloor values to find the optimal setting.
  • Consider adding logging or debugging statements to the run.ts file to better understand the compaction trigger logic and identify potential issues.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue appears to be a regression in version 2026.4.11, and previous reports (#24800 and #5433) were closed without a full resolution. The provided workaround (setting reserveTokensFloor: 20000) reduces the severity but does not address the root cause.

Recommendation

Apply workaround: setting reserveTokensFloor to a suitable value, as it can help mitigate the issue, but further investigation is needed to implement a more proactive compaction trigger.

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 fires proactively when context approaches the limit (e.g. at contextWindow - reserveTokensFloor), before the API returns an overflow error.

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 not triggering during tool-use loops — regression on 2026.4.11 [1 participants]