Skip to content

[Bug]: Auto-compaction not triggering during tool-use loops — regression on 2026.4.11 #69838

@Neo-Creator-1

Description

@Neo-Creator-1

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions