Skip to content

fix(memory): index notes when optional embeddings cannot start - #139463

Merged
steipete merged 2 commits into
mainfrom
codex/local-memory-bootstrap
Sep 5, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/local-memory-bootstrap

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

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:

Operation Baseline Candidate
memory index --agent main --force before any search Exit 1: missing OpenAI embedding credential Exit 0: note indexed
Separate memory search "Orchid compass" --agent main --json Exact note returned after search bootstrap Exact note returned from the built index
Configuration and note bytes Unchanged Unchanged

Four 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.

Apply the existing optional embedding bootstrap lifecycle to sync before the first search. Preserve required provider errors, recovery, and index ownership.
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core size: S maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete steipete self-assigned this Sep 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 7:02 PM ET / 23:02 UTC.

ClawSweeper review

What this changes

Memory 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
Reviewed head: 916171eca4caf5cebabdb0ad997f38be2361af12

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow owner-level repair with relevant CLI observations, meaningful regression coverage, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied CLI before/after observations exercise manual indexing through the changed manager on a fresh credential-free profile, followed by successful note retrieval. The test-only follow-up preserves the production revision covered by that proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied CLI before/after observations exercise manual indexing through the changed manager on a fresh credential-free profile, followed by successful note retrieval. The test-only follow-up preserves the production revision covered by that proof.
Evidence reviewed 9 items Introduced production change: The complete merge-base-to-head production diff removes only the search-specific admission condition around optional provider initialization failure; required providers still rethrow.
Current main still contains the defect: On fetched main, a first ordinary sync has neither allowEmbeddingBootstrapFallback nor an earlier bootstrap failure, so provider initialization errors escape before keyword indexing.
Latest release comparison: The supplied latest-release commit for v2026.9.2 also retains the restrictive initialization condition; this change is not already present there.
Findings None None.
Security None None.

How this fits together

Memory 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -2, Tests +52, Docs +1. Total +51 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 4 -2
Tests 2 62 10 +52
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 66 15 +51

Review metrics

None.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This repairs a bounded memory-indexing failure for configurations that already support optional embeddings.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied CLI before/after observations exercise manual indexing through the changed manager on a fresh credential-free profile, followed by successful note retrieval. The test-only follow-up preserves the production revision covered by that proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied CLI before/after observations exercise manual indexing through the changed manager on a fresh credential-free profile, followed by successful note retrieval. The test-only follow-up preserves the production revision covered by that proof.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-05T22:49:40.673Z sha 075e376 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 64a7abd into main Sep 5, 2026
144 checks passed
@steipete
steipete deleted the codex/local-memory-bootstrap branch September 5, 2026 23:05
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 5, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…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
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 20, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant