Repository navigation
fix: memory indexing stops after embedding provider reload - #160048
NianJiuZst wants to merge 4 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 1, 2026, 2:32 AM ET / 06:32 UTC (Revision 5). ClawSweeper reviewWhat this changesMemory Core background indexing acquires the current embedding provider through its owning plugin instance and retains startup, session-update, and watcher work until completion. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful fix: current main still retains the stale background snapshot. The earlier watcher defect is repaired, and the final-head evidence resolves the previous compatibility concern. No actionable patch finding remains. Likely related people: steipete (high confidence) and jalehman (medium-confidence routing candidate). Priority: P1 Review scores
Verification
How this fits togetherMemory Core turns memory files and session transcripts into a searchable SQLite index using embedding-provider plugins. Background callbacks must follow provider reloads while preserving ownership of work already underway. flowchart TD
A[Memory files and transcripts] --> B[Watchers and background timers]
B --> C[Detach foreground context]
C --> D[Owning plugin admission]
D --> E[Current embedding provider]
D --> F[Reject retired owners]
E --> G[Searchable SQLite index]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +68, Tests +429, Docs +6. Total +503 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep background indexing bound to Memory Core's live instance, preserving admitted registry generations and existing index contents through reload. Do we have a high-confidence way to reproduce the issue? Yes: current-main source establishes the retained-snapshot mechanism, and the linked report supplies an interval/adoption regression path. This read-only review did not execute a failing current-main Gateway. Is this the best way to solve the issue? Yes: the patch reuses existing plugin-instance admission and migrates all former helper callers while awaiting actual synchronization; registration-time capture alone cannot cover retained-instance provider reloads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e304e4ffc6d9. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
fd95095 to
692a05b
Compare
|
Exact-head CI note for This failure is inherited from integrated main |
|
Related-work update: #167679 has merged the instance-bound background indexing repair, and #167724 has merged the separate Dreaming state ownership repair. The latest review on #159912 identifies both merged fixes and notes that this PR remains an open closing candidate. Could the author or a maintainer check whether this PR retains any distinct fix or regression coverage worth carrying forward, and otherwise reconcile it as superseded? The latest reporter evidence is still from 2026.9.9 without those fixes, so post-fix production validation remains separate from PR cleanup. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: memory indexing stops after embedding provider reload This is item 1/1 in the current shard. Shard 0/1. This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Thanks for this work. The outage it targets is now fixed on We re-verified on current |
Closes #159912
What Problem This Solves
Fixes background memory indexing continuing to use a retired embedding plugin after a provider-only reload retains the existing Memory Core instance.
User Impact
Watcher, interval, startup catch-up, and session-update work can acquire the replacement provider without a foreground search or Gateway restart. Already admitted work keeps its original registry, and retiring memory instances reject new work. This PR requires no configuration or database migration.
Why This Change Was Made
A module-load async-context snapshot removes foreground turn state but also restores the registry from module load. Background work now combines turn detachment with fresh admission through its exact, retained Memory Core instance. Startup and session-update preparation await their inner synchronization.
The remaining file-watcher lifecycle calls are migrated too: startup captures its owning instance; cleanup uses detached context without requesting new admission from a retiring instance. Cleanup remains available during retirement, and a failed cleanup promise does not retain the closing caller's turn.
Current main was integrated at
7669e8bd04to resolve two insertion conflicts. Both the background-task helper and main's watcher-health getter are retained; both the retirement regression and main's polling/health tests remain intact.Related: #159921 handles registration-time context after an in-process restart and explicitly excludes this retained-instance provider-only reload case.
Evidence
Final validated head:
0a3bf14e68f7fc1c12bb8d26d4780ae6f8aa2a8e. Runtime: Node 24.19.0 and repository-pinned pnpm 12.5.1.Actual Gateway provider-only reload, repeated after integration
Ran a real isolated Gateway on the clean final head with synthetic memory and a free deterministic embedding plugin. The Gateway, public plugin contracts, WebSocket
plugins.reloadmethod, filesystem watcher, and SQLite writes were real. The embedding implementation was a local fixture; this is not live llama-cpp or hosted-provider validation.The persistent manager and watcher were created under provider A, before its lazy factory had run. Through a persistent Gateway connection, only the embedding plugin was reloaded. A was disposed without acquisition. A subsequent file write was embedded by B and observed directly in SQLite before any further foreground call. Only afterward did a public-SDK identity check confirm the exact manager object and Gateway process were retained.
Redacted final-head before/after reload trace:
Indexed text: “Aster observatory replacement telescope calibration is verified after provider reload.”
No foreground search, manual registry adoption, callback delivery, fake timer, or scheduling override was used. The retained-manager case intentionally reloads before A is acquired; existing lifecycle policy retires a manager that already owns the outgoing adapter. This is final-code before/after reload evidence, not a negative runtime comparison against the original implementation. Native-event watching was observed; polling fallback and official live providers were not exercised.
Compatibility
The same existing SQLite database remained in use. Before and after reload/indexing:
user_version=24, 196 schema objects, identical schema SHA-25610ffa8c8aa8c11e15eed5b4c8d9a439f4cb6597ab97becc2924dda5df19bbd06. Relative to current main, the production diff changes admission/lifecycle handling, not persisted schema, vector metadata layout, configuration shape, or migration rules.Additional populated-index run on the same final head:
The original row's SHA-256 remained
f52c16948973fe19be027fb563c7989f4992e45089b5001080feb418020f65a3from the completed seed CLI through Gateway reopen and new-file indexing. Independent read-only SQL found both the preserved old content and new background-indexed content. This covers same-version hot-reload compatibility against an existing populated index. It is not a published-release migration/upgrade matrix; the provider and documents were isolated synthetic fixtures.Final-head validation
qaRuntimebuild passed in 92.9 s, including all 96 external plugin bundles, CLI bootstrap checks, native loading of 53 built modules/doctor closures, postbuild checks, and final-head stamps. Runtime bundling used--concurrency 1,OPENCLAW_TSDOWN_MAX_OLD_SPACE_MB=4352, andRAYON_NUM_THREADS=2for this memory-limited host.git diff --checkpassed. Independent review found no remaining P0–P2 findings in the watcher repair or conflict resolution.pnpm test extensions/memory-core/src/memory/file-watcher.lifecycle.test.ts --maxWorkers=1: 20 cases passed, 43.19 s wall. Cold worker preparation accounted for 27.60 s; the new test body took 39 ms. It uses the existing watcher fixture to cover owning-instance capture and physical retirement, which the generic admission tests cannot observe. No real timer or Gateway boot was added to per-PR CI.Earlier-head evidence and limits
692a05b8: all 12 existing watcher lifecycle tests failed withrunInMemoryBackgroundContext is not a function.3591280: 88 selected tests and a complete build of its exact source tree passed, including all declaration batches, 96 plugin bundles, 53 native module loads, all 158 public SDK subpaths, and Control UI compilation. Initial attempts hit resource failures; the successful full build used serialized runtime bundling plusGOMEMLIMIT=2GiBandGOGC=50. It printed a non-failing UI gzip-budget advisory (217.2 KiB versus 215 KiB). Line-cap/max-lines and assertion-safety guards also passed on that repair.Hosted CI: inherited baseline blocker
Exact-head CI completed: 44 jobs passed and 23 were skipped. Six typecheck jobs failed, making the aggregate gate fail. Every failing typecheck reports the same
TS2304: Cannot find name 'readMissingScopeError'atui/src/components/session-group-defaults-dialog.ts:123(job log). The core production and plugins-platform test-type graphs passed.This is inherited from integrated main, not introduced by this PR: the UI file has identical blob
f9000417936584d432760473b0a73e462dc69198at main7669e8bd04and this head. Upstream commit 4293f49c54 adds the call without its import; the existing maintainer CI note independently records the same diagnosis. The unrelated UI file is unchanged by this PR.The five additional failed jobs were inspected individually; each reports only the same missing
readMissingScopeErrorname at the same UI file/line:Final-head review accepted the runtime proof and found no actionable patch or security findings. Its readiness summary noted incomplete hosted-failure attribution; the individual logs above provide that attribution. The review still retains a generic data-model compatibility checklist item, while its technical assessment states that no stored-data contracts changed; the Compatibility section above now also records a supported-CLI-seeded populated-index run preserving the complete original chunk row while background indexing adds new content after reload. This evidence covers same-version hot reload, not a published-release upgrade matrix. CI is still red until the inherited UI error is addressed. No CI rerun or merge has been requested.