自动压缩卡死防复发:校验 memoryFlushCompactionCount 仅在成功后写入
场景:compaction 失败时仍更新 `memoryFlushCompactionCount`,导致后续 auto-compaction 永久不触发。可用‘阈值监控+计数比对+临时解锁’应急。
GITHUBDiscovered 2026-02-14Author bcdotjs
Prerequisites
- Compaction with memory flush is enabled and session token metrics are observable.
- Operator can inspect sessions store JSON and gateway logs.
Steps
- Identify sessions above threshold where compaction should have happened but token count keeps rising.
- Compare `compactionCount` and `memoryFlushCompactionCount`; if equal after failed flush, mark as blocked.
- Check logs for missing `auto_compaction_end` around memory flush windows.
- Apply temporary unblock (manual count adjustment) only for emergency continuity, then retest compaction path.
Commands
openclaw gateway statusopenclaw logs --local-timecat ~/.openclaw/agents/main/sessions/sessions.jsonVerify
After fix/workaround, next flush cycle emits compaction completion and counters no longer get stuck at equal values.
Caveats
- Manual edits to sessions store are risky; backup first and keep a rollback copy.
- Potential provider/model interaction is still under investigation (needs verification).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗