fix(memory): detect unindexed session transcripts in status mode (fixes #97814)#97842
Conversation
|
Thanks for the context here. I did a careful shell check against current Current main already fixes the memory status false-clean bug through the merged canonical PR, with a regression test on the real status-purpose manager path. This branch now duplicates that status dirty detection and adds unnecessary memory-host SDK export surface. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the current main implementation from the merged canonical PR and close this branch as superseded by that shipped-to-main path. Do we have a high-confidence way to reproduce the issue? No for current main: the original false-clean source path is no longer present because status-purpose manager creation awaits the existing session catch-up dirty-file check before status() is read. The old bug remains source-reproducible in pre-fix history and in the linked issue context. Is this the best way to solve the issue? No. Current main already uses the cleaner awaited-helper implementation from the merged canonical PR, so this branch's extra synchronous detector and SDK export additions are no longer the best fix. Security review: Security review cleared: The diff touches memory-core runtime/tests and memory-host SDK exports only; I found no dependency, CI, secret, package, permission, or supply-chain change. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against a51b06fd4d37; fix evidence: commit 742f0c9f8268, main fix timestamp 2026-06-30T17:47:43-07:00. |
5dfb07b to
0224164
Compare
Status-mode MemoryManager initialization skipped ensureSessionStartupCatchup(), causing plain 'memory status' to report dirty=false when unindexed usage-counted session transcripts existed on disk. Add synchronous detectSessionStartupDirtySync() that compares on-disk session files against memory_index_sources rows during status-mode construction, so the dirty flag is accurate without triggering a full sync. Fixes openclaw#97814
Replace resolveSessionTranscriptsDirForAgent + readdirSync with listSessionTranscriptCorpusEntriesForAgentSync so the status-mode dirty check respects configured/fixed custom session stores and ownership filtering, matching the async startup catch-up path. Export listSessionTranscriptCorpusEntriesForAgentSync through the memory-host-sdk and plugin-sdk barrels.
0224164 to
7727c4b
Compare
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
openclaw memory status(plain, without--index) reportsdirty=falsewhen unindexed usage-counted session transcripts exist on disk. Operators rely on this command as the primary health check for memory recall — a false-clean signal means session transcripts go unindexed indefinitely, causing silent recall gaps.The root cause is that the status-mode
MemoryManagerinitialization path skipsensureSessionStartupCatchup(). Whenpurpose === "status", the constructor does not detect whether on-disk session files have correspondingmemory_index_sourcesrows.Why This Change Was Made
The constructor at
extensions/memory-core/src/memory/manager.ts:436gatesensureSessionStartupCatchup()behind!transient, andtransientistrueforpurpose === "status". This meanssessionsDirtyis never set during status-mode initialization, sostatus()at line 1146 always reportsdirty: falsefor the sessions dimension.PR #82341 added startup catch-up for normal manager startup, but the status-purpose initialization path still bypasses it.
User Impact
openclaw memory statusget a false-cleandirty=falsesignal when unindexed session transcripts exist--indexor--forceis usedEvidence
Real behavior proof
openclaw memory statusreportsdirty=falsewhen unindexed usage-counted session transcripts exist on diskpnpm build, rannode openclaw.mjs memory status --jsonto verify baseline behavior, then ran the memory-core extension test suite to verify the fixBaseline behavior (no sessions source configured on local agent):
Test verification (1000/1000 pass, including new sync detection test):
New test
detects unindexed session files synchronously for status modeverifies thatdetectSessionStartupDirtySync()correctly setssessionsDirty=truewhen unindexed session files exist, without triggering background sync.memory_index_sourcesrows during status-mode construction. When unindexed files exist,sessionsDirtyis set totrueandstatus()reportsdirty: true.main) does not havesessionsconfigured as a memory source, so the CLI behavior is unchanged on this machine. The fix is verified through the extension test suite which creates a test harness with sessions source configured.Changes Made
extensions/memory-core/src/memory/manager-sync-ops.ts— AddeddetectSessionStartupDirtySync(): synchronous detection of unindexed session transcripts for status-mode initializationextensions/memory-core/src/memory/manager.ts— CalldetectSessionStartupDirtySync()whenpurpose === "status"in constructorextensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts— Added test for synchronous status-mode detectionAI-assisted (Hermes Agent)