fix(memory-core): resolve adapter default model for index identity state#90447
fix(memory-core): resolve adapter default model for index identity state#90447Kailigithub wants to merge 1 commit into
Conversation
When agents.<id>.memorySearch.model is left at the default empty string and the embedding adapter exposes a defaultModel (e.g. OpenAI text-embedding-3-small), `openclaw memory status` reported a mismatch against a blank expected model and paused vector search, even though `--deep` status and `memory index --force` succeeded. resolveCurrentIndexIdentityState built configuredProvider directly from this.settings.model, so the empty default survived as the expected model. The provider path that actually creates embeddings resolves the adapter's defaultModel, but the cheap status-only path never initialised the provider and never reached that branch. Resolve the adapter defaultModel up front via the existing resolveEmbeddingProviderFallbackModel helper (same module) so the status path computes the same expected model as the index/deep paths. Apply a symmetric fallback in refreshIndexIdentityDirty for the case where the provider is initialised but its model is still falsy. Closes openclaw#90413
|
Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 3:35 PM ET / 19:35 UTC. Summary PR surface: Source +19. Total +19 across 2 files. Reproducibility: yes. from source at medium confidence: when resolved settings still carry a blank model, current main's status-only identity path compares index metadata against that blank model before provider initialization resolves adapter defaults. I did not run a live OpenClaw memory setup in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land a narrow memory-core fix that makes status-only identity checks use the same effective embedding model as provider initialization, with focused regression coverage and redacted real setup proof before merge. Do we have a high-confidence way to reproduce the issue? Yes from source at medium confidence: when resolved settings still carry a blank model, current main's status-only identity path compares index metadata against that blank model before provider initialization resolves adapter defaults. I did not run a live OpenClaw memory setup in this read-only review. Is this the best way to solve the issue? Yes for the code shape: using the existing embedding fallback helper in the status identity path is a narrow way to align expected-model calculation with provider initialization. It still needs a regression test and contributor real-behavior proof before merge. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 8605076a6f00. Label changesLabel justifications:
Evidence reviewedPR surface: Source +19. Total +19 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Summary
openclaw memory statusreportedIndex identity: index was built for model <X>, expected(blank expected) andVector search: paused until memory is rebuiltwheneveragents.<id>.memorySearch.modelwas left at its default empty string and the embedding adapter exposes adefaultModel(e.g. OpenAItext-embedding-3-small).memory status --deepandmemory index --forcereported the system as healthy, but the plain status path declared a mismatch and downstreammemory_searchcalls returneddisabled: true, error: "index metadata is missing".Root cause
MemoryManagerSyncOps.resolveCurrentIndexIdentityStatebuiltconfiguredProviderdirectly fromthis.settings.model. With the default empty-string setting, the configured provider'smodelwas always"", so identity validation comparedmeta.model !== ""and declared a mismatch with a blank "expected" model. The provider init path that runs on--deep/--indexresolves the adapter'sdefaultModelviaresolveProviderModel, but the cheap status-only path never reached that branch (providerInitialized: false,this.provider === undefined).Fix
resolveCurrentIndexIdentityState, resolve the adapter'sdefaultModelup front via the existingresolveEmbeddingProviderFallbackModelhelper whenthis.settings.modelis empty/whitespace, so the status path computes the same expected model as the index/deep paths.refreshIndexIdentityDirty, apply a symmetric fallback so the initialised-provider branch also tolerates a falsythis.provider.model.Both edits reuse helpers already present in
embeddings.ts; no new dependencies or configuration surfaces.Verification
ts.transpileModule(Node 22) on both modified files: no diagnostics.text-embedding-3-small; explicit model preserved;provider === "none"still returns null; whitespace-only model also falls back.cli.test.ts"prints index identity mismatch reasons"test covers the formatting path and is unaffected because the status object shape is unchanged.Local vitest run is unavailable in this environment (rolldown/oxlint native bindings not installed for this platform); CI will exercise the full test suite.
Closes #90413