Skip to content

[Bug]: Auto-compaction not triggering on context overflow #12705

@Nibblemor

Description

@Nibblemor

Environment:

• OpenClaw version: 2026.2.6-3 (latest)
• Model: zai/glm-4.7
• OS: macOS 15.7.3 (arm64), Node 24.3.0
Current config:

JSON

{
"compaction": {
"mode": "safeguard",
"reserveTokensFloor": 50000
},
"contextTokens": 100000
}
Issue:
Auto-compaction failed to trigger. Session grew to 137k tokens (37k OVER the 100k limit) before manual compaction was required.

Expected behavior:
Auto-compaction should trigger when approaching/exceeding contextTokens (around 80-100k tokens).

Actual behavior:
No auto-compaction occurred. Session hit context overflow at 137k tokens. Had to run /compact manually to reduce to 21k tokens.

Possible causes:

• Token counting bug with GLM-4.7 provider
• Safeguard mode not detecting context limit correctly
• Silent memory flush may not be running
Config shows memoryFlush is enabled:

JSON

"memoryFlush": {
"enabled": true,
"softThresholdTokens": 15000
}
Is this a known issue with the GLM-4.7 integration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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