Repository navigation
fix(memory): index notes when optional embeddings cannot start - #139463
Conversation
Apply the existing optional embedding bootstrap lifecycle to sync before the first search. Preserve required provider errors, recovery, and index ownership.
|
🦞👀 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: needs maintainer review before merge. Reviewed September 5, 2026, 7:02 PM ET / 23:02 UTC. ClawSweeper reviewWhat this changesMemory Core lets manual and background indexing build a keyword index when optional embeddings cannot initialize, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary: current main and v2026.9.2 still reject indexing before the first search when optional embeddings cannot initialize. No blocking findings remain, and the test follow-up preserves meaningful shutdown-drain coverage. Priority: P2 Review scores
Verification
How this fits togetherMemory Core turns workspace notes and session content into a searchable local index. Manual commands and background updates share its indexing lifecycle, which selects semantic indexing or the existing keyword-only fallback. flowchart TD
A[Notes and session content] --> B[Manual or background indexing]
B --> C[Initialize embedding provider]
C --> D{Provider outcome}
D -->|Available| E[Semantic indexing]
D -->|Optional and unavailable| F[Keyword indexing]
D -->|Required and unavailable| G[Visible error]
E --> H[Memory search]
F --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -2, Tests +52, Docs +1. Total +51 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Use the shared indexing lifecycle to establish optional keyword fallback while retaining required-provider errors, semantic-index protection, and existing recovery behavior. Do we have a high-confidence way to reproduce the issue? Yes: current-main source establishes that indexing a fresh profile before search rethrows optional embedding initialization errors. The PR also supplies a matching CLI before/after observation; this review did not execute it. Is this the best way to solve the issue? Yes: correcting shared sync admission fixes both manual and background callers without duplicating fallback logic in each caller or forcing users to change provider settings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 984d417f8077. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* origin/main: (95 commits) perf(build): avoid unrelated gateway artifact scans (#127757) fix(update): deliver terminal progress after long updates (#139289) fix(ui): show session hover cards for local chat URLs (#139384) perf(ui): reuse unchanged transcript key snapshots (#139400) fix(ui): make subagent sessions view-only (#139381) fix: open agent state on SQLite builds without extensions (#139487) perf(skills): detach cached metadata from source strings (#139478) fix(ui): show primary user in multi-agent profile hero (#136736) perf(sessions): stop decoding the session row four times per SQLite entry patch (#136361) refactor(exec): share package-manager option scans (#139482) fix(ci): authorize frozen mobile release candidates (#139441) fix: avoid session deletion slowdown in large session stores (#139467) perf(gateway): reuse node invocation idle timers (#139354) fix(auth): preserve selected profiles across plugin scopes (#139413) fix(discord): retain voice input until transcription completes (#139484) fix(agents): name Gateway storage failures in run-failure copy (#139409) fix: keep subagent checks responsive in large session stores (#139450) fix(memory): index notes when optional embeddings cannot start (#139463) fix: refresh pending approvals when reopening chat (#139457) fix(tooling): preserve Git hook choices during install (#139461) ...
…law#139463) * fix(memory): initialize keyword fallback before background indexing Apply the existing optional embedding bootstrap lifecycle to sync before the first search. Preserve required provider errors, recovery, and index ownership. * test(memory): preserve failed-startup repair drainage coverage
…law#139463) * fix(memory): initialize keyword fallback before background indexing Apply the existing optional embedding bootstrap lifecycle to sync before the first search. Preserve required provider errors, recovery, and index ownership. * test(memory): preserve failed-startup repair drainage coverage (cherry picked from commit 64a7abd)
Related: #115397
What Problem This Solves
Fixes an issue where users indexing memory before their first search would receive a missing embedding-provider credential error, even though their configuration supports keyword-only search. The same startup, session-update, and post-compaction indexing paths repeatedly failed in an Ollama-only profile.
Why This Change Was Made
The memory manager now applies its existing optional-provider initialization lifecycle to indexing as well as search. Required explicit providers still fail visibly. Provider selection, request-time fallback, retry TTL, index generations, queue ownership, and storage formats remain unchanged.
User Impact
Manual and background indexing can build the keyword index when optional embeddings cannot initialize. Search can immediately use those indexed notes. The existing diagnostic still explains that semantic vectors are unavailable; this does not provision an embedding model or claim semantic search is working.
Evidence
A real isolated CLI reproduction used a fresh profile and synthetic note without provider credentials:
memory index --agent main --forcebefore any searchmemory search "Orchid compass" --agent main --jsonFour regression cases fail on unchanged production. The candidate passes 131 tests across eight memory suites, covering optional omitted/auto/local providers, required-provider failures, concurrent bootstrap, recovery, startup catchup, targeted sync queues, and lease cleanup. Both full builds, changed-file repository checks, and an independent P0–P2 code review passed.
Production is net −2 lines; tests net +52; docs net +1. Timing was recorded but is not presented as a speed improvement because host load differed.
CI initially exposed a stale startup-failure assumption in the existing candidate-repair test. Its follow-up now fails the first real sync through the supported progress callback, requires a separately admitted retry, and verifies close drains that retry and its indexed candidates survive reopening. The focused 43-test set, extension-test typecheck, typed lint, and independent P0–P2 review pass. The follow-up changes tests only; the CLI proof remains bound to production commit
075e3761618a5c35cf9b356b71f7b97b0dc8696e.