fix: only advance memoryFlushCompactionCount when compaction ran (closes #12590)#46513
fix: only advance memoryFlushCompactionCount when compaction ran (closes #12590)#46513Br1an67 wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes a bug in The fix is a minimal, targeted 4-line conditional spread:
Confidence Score: 5/5
Last reviewed commit: 7e5fb5d |
openclaw#12590) runMemoryFlushIfNeeded unconditionally persisted memoryFlushCompactionCount after every flush turn, even when compaction didn't complete. This synchronized both counters, causing shouldRunMemoryFlush to skip the next cycle (flush, skip, flush, skip pattern). Only persist the updated count when memoryCompactionCompleted is true, so the counters stay desynced and every compaction cycle triggers a flush as expected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Closing to manage active PR count. Will reopen when slot is available. |
Summary
runMemoryFlushIfNeededunconditionally persistedmemoryFlushCompactionCountafter every flush turn, even when compaction didn't complete during that turn. This synchronized both counters (compactionCount === memoryFlushCompactionCount), causingshouldRunMemoryFlushto returnfalseon the next cycle — producing the "flush, skip, flush, skip" pattern.Only persist the updated
memoryFlushCompactionCountwhenmemoryCompactionCompletedis true. When compaction doesn't run, the counters stay desynced, so the next compaction cycle correctly triggers a flush.Change Type
Bug fix
Scope
src/auto-reply/reply/agent-runner-memory.ts—runMemoryFlushIfNeeded()Linked Issue
Closes #12590
Security Impact
None.
Evidence
pnpm buildpassesHuman Verification
Compatibility
Backward-compatible. Existing sessions may have synced counters from the old bug; the next compaction after this fix will desync them naturally.
Risks
None — the dedup logic still prevents double-flushing within the same compaction count.
This PR was AI-assisted (fully tested with pnpm build/check/test).