Repository navigation
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Bug Report
Version: OpenClaw 2026.6.1 (2e08f0f)
OS: macOS 15.4.0 (arm64, M4 Mac Mini)
Summary
The gateway's memory auto-sync creates a dead loop: it indexes files (creating chunks) but never writes the meta table entry (memory_index_meta_v1), so indexIdentityState remains "missing" forever. All memory_search calls return "index metadata is missing" with 0 results.
Root Cause (from source analysis)
In manager-dZw31DAG2.js, the runSync() method at ~line 2073:
if (indexIdentity.status !== "valid" && !needsFullReindex) {
this.dirty = true;
// ... mark sessions dirty
return; // ← Returns without writing meta!
}The condition needsFullReindex is false when hasIndexedChunks is true (which it is, because the sync itself just created chunks). So after the first sync cycle:
- Identity is "missing" (no meta)
hasIndexedChunks= true (sync created chunks)needsInitialIndex= false (has chunks)needsExplicitIdentityReindex= false (not CLI-triggered)- Early return without writing meta
- Next sync → same loop
Reproduction
- Start with an empty
metatable inomes-vec.db(e.g., after DB corruption or version upgrade) openclaw gateway start- Gateway auto-sync runs, indexes files, creates chunks
memory_searchreturns"index metadata is missing"- Running
openclaw memory index --forcefrom CLI writes meta correctly - But gateway restart clears meta again (gateway re-syncs from scratch)
Workaround Attempted
openclaw gateway stop→ clear DB →openclaw memory index --force→openclaw gateway start- Gateway starts, sees existing chunks, but still enters the dead loop because its sync finds identity "missing" and hasIndexedChunks=true
Environment
- Embedding provider:
openai-compatible(local oMLX on localhost:8000, modelbge-m3-mlx-fp16) - DB:
~/.openclaw/memory/omes-vec.db(SQLite with sqlite-vec) - Extra paths: 4 external directories (~1200 files total)
- 6 agents configured, all show
providerState: pendingafter gateway starts
Expected Behavior
When gateway auto-sync encounters identity "missing" but has indexed chunks (from its own sync or CLI), it should either:
- Write meta after completing the sync (even if identity is still "missing"), OR
- Treat "identity missing + has chunks from current sync" as
needsInitialIndex = true
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Jun 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 4, 2026, 9:27 AM ET / 13:27 UTC.
Summary
This should stay open: current main and v2026.6.1 still contain the reported memory-index state where missing metadata plus existing chunks leaves the manager dirty and search paused instead of repairing the metadata or rebuilding.
Reproducibility: yes. at source level: current code can be put in the reported state by indexing chunks, deleting
memory_index_meta_v1, and running non-CLI sync/search. I did not run a live gateway repro in this read-only pass.Next step
This is a narrow, source-reproducible memory-index consistency bug with clear likely files and validation.
Review details
Best possible solution:
Make the memory manager recover missing metadata with existing chunks by forcing the existing safe reindex path or by writing validated metadata, then cover that gateway-style state with a focused regression test.
Do we have a high-confidence way to reproduce the issue?
Yes, at source level: current code can be put in the reported state by indexing chunks, deleting
memory_index_meta_v1, and running non-CLI sync/search. I did not run a live gateway repro in this read-only pass.Is this the best way to solve the issue?
Yes, the narrow maintainable fix belongs in the existing memory-index manager recovery/reindex decision, not in a new config option or gateway-specific workaround.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 550f70756574.
Label changes
Label changes:
P2: The bug can make memory search unusable for affected local-memory users, but it is scoped to memory-index recovery and has a reported manual force-index workaround.impact:session-state: The issue is about persistent memory-index metadata drifting from indexed chunks, which affects recall and session memory state.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: The bug can make memory search unusable for affected local-memory users, but it is scoped to memory-index recovery and has a reported manual force-index workaround.impact:session-state: The issue is about persistent memory-index metadata drifting from indexed chunks, which affects recall and session memory state.Evidence reviewed
Acceptance criteria:
What I checked:
runSync()treats missing identity with existing chunks as not needing a full reindex unless the caller is CLI or forced, then marks dirty and returns before any metadata write. (extensions/memory-core/src/memory/manager-sync-ops.ts:1847, 550f70756574)memory_index_meta_v1, but the reported branch returns before those paths run. (extensions/memory-core/src/memory/manager-sync-ops.ts:2120, 550f70756574)extensions/memory-core/src/memory/manager.ts:505, 550f70756574)memory_index_meta_v1after indexing and expects search to return an empty result set while identity remains missing, so there is no recovery coverage for this scenario yet. (extensions/memory-core/src/memory/index.test.ts:495, 550f70756574)extensions/memory-core/src/memory/manager-sync-ops.ts:1792, 2e08f0f4221f)Likely related people:
extensions/memory-core/src/memory/manager-sync-ops.ts,extensions/memory-core/src/memory/manager.ts,extensions/memory-core/src/memory/index.test.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.mnowrot commentedon Jun 4, 2026
Confirming this on Linux (v2026.6.1) with builtin provider. Additionally found that even when meta IS written (via CLI
--forcewhile gateway is running), the running gateway never sees it because the atomicrename()swap inrunSafeReindexonly replaces the directory entry — the gateway process holds an open fd to the old inode and there's no re-open path.Also found
resolveInitialMemoryDirty()at line ~3188 always returns true for memory-source agents on startup, guaranteeing a reindex every boot regardless of actual state.Full details cross-posted on #90042.
fix(memory-core): trigger verified reindex on missing-meta recovery
vincentkoc commentedon Jun 8, 2026
Fixed on
mainin d46dc39.What changed:
Proof run on the pushed patch:
node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-memory.config.ts extensions/memory-core/src/memory/index.test.ts extensions/memory-core/src/memory/manager-reindex-state.test.ts-> 49 passed.node scripts/run-oxlint.mjs extensions/memory-core/src/memory/manager-sync-ops.ts extensions/memory-core/src/memory/index.test.ts-> clean.git diff --check-> clean..agents/skills/autoreview/scripts/autoreview --mode local->autoreview clean: no accepted/actionable findings reported.Remote proof:
origin/mainresolves tod46dc39b18ec0fdc8c9967f0a8301949b2e5a9e3. GitHub checks for that exact SHA had started at closeout; no failures observed yet, several checks still pending/in progress.fix(memory): rebuild missing index metadata safely
fix(memory): rebuild missing index metadata safely