-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
Compaction abort triggers duplicate memory flushes #30115
Copy link
Copy link
Closed
Description
Bug
When a compaction wait is aborted (e.g. due to context limit pressure), the memory flush fires before compaction completes. The same pre-compaction context then re-triggers another flush on the next cycle, writing identical content to the memory file.
Impact
Over time, MEMORY.md accumulates duplicate entries (we've seen 4-7x duplicates of the same block). This wastes context window space and causes the edit tool to fail (can't find unique text matches when identical blocks exist).
Reproduction
- Run a long session that approaches context limits
- Compaction triggers but aborts (
compaction wait abortedin logs) - Memory flush fires with the pre-compaction context
- On next compaction cycle, the same context triggers another identical flush
- MEMORY.md now has duplicate entries
Current Workaround
We patched shouldRunMemoryFlush() in the dist JS to add a filesystem sentinel with a 5-minute cooldown (/tmp/openclaw-flush-sentinel). This reduces but doesn't eliminate duplicates, and gets overwritten on every update.
Suggested Fix
Either:
- Track what context was last flushed (hash or compaction count) and skip if unchanged
- Don't trigger memory flush on compaction abort — only on successful compaction
- Add a built-in cooldown/dedup mechanism to the flush pipeline
Environment
- OpenClaw 2026.2.26
- Model: claude-opus-4-6
- Running with
reserveTokensFloor: 5000
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.