Skip to content

fix(embeddings): pause search deadline during local readiness - #156909

Closed
Alix-007 wants to merge 7 commits into
openclaw:mainfrom
Alix-007:alix/fix-embedding-readiness-20260924
Closed

Alix-007 wants to merge 7 commits into
openclaw:mainfrom
Alix-007:alix/fix-embedding-readiness-20260924

Conversation

@Alix-007

@Alix-007 Alix-007 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #156359

What Problem This Solves

Managed Ollama and LM Studio embedding startup can consume the memory_search deadline because the dedicated local-service acquisition paths omit the existing readiness-wait callback.

User Impact

The intended behavior is for the search deadline to pause while the managed local embedding service becomes ready, and resume for embedding and retrieval. The patch wires the existing deadline control through the dedicated adapters and memory-provider initialization. A real managed cold-start memory_search acceptance run is still missing; the provider-entry tests below do not establish that end-to-end result.

Why This Change Was Made

The shared memory deadline-control contract already exposes depth-balanced pause and resume reporting. The fix forwards that control through Ollama acquisition, LM Studio acquisition/preload/variant discovery, and the memory provider initialization path. HTTP, cancellation, preload, and lease cleanup remain with their existing owners.

Existing Evidence and Limits

The following observations were recorded before the type-only correction below and are retained as historical evidence, not as new executions on the latest head:

  • Provider-entry tests drove both real embed() implementations with controlled local-service acquirers and embedding responses. The callbacks produced pause -> resume (2 tests passed). These are adapter wiring tests: the acquirer itself reports readiness, so they are not real managed-service cold-start proof.
  • The LM Studio initialization follow-up added control forwarding for preload and variant discovery, plus a focused preload regression using a controlled acquirer.
  • Earlier oxfmt --check, focused extension lint, and git diff --check receipts remain historical; none is relabeled as a fresh check of the type-only follow-up.
  • The linked issue's red/control reproduction reported no Ollama callback and expiration of a 150 ms search budget during a 300 ms acquisition, contrasted with the shared provider's pause/resume path. No new cold-start baseline or after-fix search was executed during this continuation.

Review correction: keep provider-creation control memory-specific

Previous reviewed head: 2b08efbc02e5949e8da83b7c8985fe381e5bd503.
Current head: abbec3271ab950493c073d5020e5b05736109758.

The review recommended confining the memory-specific creation option instead of expanding the generic embedding-provider SDK contract. This follow-up takes that option:

  • MemoryEmbeddingProviderCreateOptions now explicitly composes MemorySearchDeadlineControlOptions at the existing memory registry contract.
  • Generic EmbeddingProviderCreateOptions no longer acquires the memory-only option. Its entire source file is restored byte-for-byte to the PR base blob 69966befb508a10bb160ea507b878257f1f2b9ec.
  • The pre-existing per-call deadline control remains unchanged. LM Studio's LocalServiceAwareEmbeddingOptions already derives from the memory-specific creation type, so its initialization callback remains expressible without a new generic SDK field.
  • Only two type-declaration files changed in this follow-up, +3/-2 lines. No provider runtime code, test assertion, test configuration, timeout, dependency, or search policy was changed.

Validation of the type-only follow-up

The exact fetched source copies were verified against Git blob IDs a2ba2934a4691b3e4136b8f30fa547038ed0dcbd and e8336c1c0510929860c3d492b0ecb625c3f4cc36. The published final blobs match the inspected candidates: generic 69966befb508a10bb160ea507b878257f1f2b9ec; memory contract 4a9a1a078037fd804c91705e4d021153c1b5a69c.

TypeScript 5.8.3 AST parsing passed. AST comparisons confirmed that declarations/imports outside the intended two creation aliases and the new type-only import are unchanged, including the existing per-call contract. TypeScript's emitted JavaScript was identical before and after for both files.

A strict extracted-declaration type probe passed: old/new memory options are mutually assignable; the generic creation type no longer declares the deadline symbol; the memory creation type and existing per-call type still do. The probe keeps unchanged foreign configuration/secret types opaque. It is a focused type-boundary check, not the full repository's tsgo graph, adapter execution, or independent review.

The COS execution connections were unavailable during this continuation. Full repository typechecking, focused provider suites, formatting/lint gates, new test timing, and managed cold-start runtime proof were not executed for this follow-up.

Actual PR Surface

The generic embedding-provider type file is restored to the PR base; the introduced changes are now in:

  • extensions/lmstudio/src/embedding-provider.ts
  • extensions/lmstudio/src/embedding-provider.test.ts
  • extensions/memory-core/src/memory/manager-provider-lifecycle.ts
  • extensions/memory-core/src/memory/manager-search-orchestration.ts
  • extensions/ollama/src/embedding-provider.runtime.ts
  • extensions/ollama/src/embedding-provider.test.ts
  • src/plugins/registry-contribution-types.ts

Persistent-data Scope and Remaining Acceptance

The readiness control is symbol-keyed, not a new serialized provider request or stored field. The type correction itself has identical emitted JavaScript. The patch changes timing/control propagation, not vector contents, dimensions, cache identity definitions, database schema, migration/backfill code, or stored-data formats. No data migration is introduced by the type correction. No migration/upgrade matrix cell or existing-index runtime compatibility run is claimed by the static checks.

Integration status observed on September 24, 2026: GitHub reported the previous 2b08efb head as not mergeable. After the type-only commits, the PR snapshot for abbec3271ab950493c073d5020e5b05736109758 reported mergeable: true, with merge commit c7057d482549b6be48a8c6674887cd894b6c0495. No rebase, merge commit authored by this continuation, or unrelated runtime edit was used. This is GitHub's mergeability observation, not a passing integration test or CI claim.

Still required:

  1. Capture real managed cold-start memory_search results for the affected providers through the actual service manager, with after-readiness retrieval/readback and applicable controls. Controlled callback/provider tests are not a substitute.
  2. Complete exact-head repository types, tests, CI, and fresh review of the narrowed contract. Revalidate integration if the head or base changes.

No upgraded rating, all-green CI, completed cold-start proof, or maintainer approval is asserted by this follow-up.

@clawsweeper

clawsweeper Bot commented Sep 24, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 24, 2026, 10:52 AM ET / 14:52 UTC (Revision 5).

ClawSweeper review

What this changes

The branch forwards memory-search deadline control through Ollama and LM Studio embedding service acquisition, including LM Studio initialization, and adds provider wiring tests.

Merge readiness

⛔ Blocked before merge - 3 items remain

Current main still lacks the documented readiness-budget behavior for the two bundled providers, and this PR remains the linked fix candidate. The earlier generic API scope concern is resolved; the managed cold-start result remains unproven.

Priority: P2
Reviewed head: abbec3271ab950493c073d5020e5b05736109758

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused patch addresses the source-level gap, but controlled callback tests leave the required real behavior proof open.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Memory Core and the two embedding adapters now pass readiness control, but the reported after-fix checks use controlled acquirers; they do not show memory_search completing through an actual managed cold start. Add redacted terminal output or logs from that path, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Memory Core and the two embedding adapters now pass readiness control, but the reported after-fix checks use controlled acquirers; they do not show memory_search completing through an actual managed cold start. Add redacted terminal output or logs from that path, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes.
Evidence reviewed 7 items Introduced runtime wiring: The pinned PR delta forwards the existing control to both provider acquisition paths and to LM Studio initialization.
Current-main gap: Current main acquires the Ollama service without a readiness callback; the LM Studio acquisition and provider initialization paths likewise lack deadline control.
Documented contract: The documentation says managed embedding readiness uses its own timeout and that search and query-embedding timers resume afterward.
Findings None None.
Security None None.

How this fits together

Memory Core receives a memory_search request and asks an embedding provider to turn the query into a vector. A managed local service may need to start before that provider can answer; the search deadline should resume after readiness.

flowchart LR
  A[Memory search request] --> B[Search deadline]
  B --> C[Memory Core provider]
  C --> D{Managed local service?}
  D -->|Yes| E[Readiness wait]
  E --> F[Ollama or LM Studio embedding]
  D -->|No| F
  F --> G[Memory results]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Memory Core and the two embedding adapters now pass readiness control, but the reported after-fix checks use controlled acquirers; they do not show memory_search completing through an actual managed cold start. Add redacted terminal output or logs from that path, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes.
  • Complete next step (P2) - Provide a redacted after-fix managed cold-start memory_search trace with result readback, and report the measured focused-test wall time.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +84, Tests +95. Total +179 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 122 38 +84
Tests 2 95 0 +95
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 217 38 +179

Review metrics

Metric Value Why it matters
Production versus test lines production +84 net, tests +95 The production growth is attributable to forwarding one existing control across provider creation and the two dedicated adapters.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/lmstudio/src/embedding-provider.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-provider-lifecycle.ts, unknown-data-model-change: extensions/ollama/src/embedding-provider.runtime.ts, vector/embedding metadata: extensions/lmstudio/src/embedding-provider.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-provider-lifecycle.ts, vector/embedding metadata: extensions/ollama/src/embedding-provider.runtime.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #156359
Summary: The linked open issue identifies the same two missing provider callbacks; this PR is its proposed fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep readiness timing with the existing Memory Core deadline owner, and verify that a managed cold start returns search results while post-readiness work and caller cancellation retain their limits.

Do we have a high-confidence way to reproduce the issue?

Yes by source inspection: current main omits the readiness callback in the dedicated Ollama and LM Studio paths. No after-fix managed cold-start search has been observed.

Is this the best way to solve the issue?

Yes in direction: the branch uses the existing deadline-control contract and keeps it memory-specific. A real managed-service search is still needed to establish the intended result.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1b32a8b3c7fc.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Managed cold-start memory searches can time out for affected local embedding providers, with limited deployment scope.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Memory Core and the two embedding adapters now pass readiness control, but the reported after-fix checks use controlled acquirers; they do not show memory_search completing through an actual managed cold start. Add redacted terminal output or logs from that path, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Post redacted after-fix terminal output or logs showing a managed Ollama or LM Studio cold-start memory_search returning results after readiness, with addresses, keys, and private endpoints removed.
  • Record the measured wall time of the new focused tests in the PR, as required by the repository test policy.

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 (4 earlier review cycles)
  • reviewed 2026-09-24T01:33:23.971Z sha bdb7fa2 :: needs real behavior proof before merge. :: [P2] Cover LM Studio's initialization readiness lease
  • reviewed 2026-09-24T02:25:58.792Z sha bdb7fa2 :: needs real behavior proof before merge. :: [P2] Cover LM Studio's initialization readiness lease
  • reviewed 2026-09-24T03:28:32.802Z sha 7f60bba :: needs real behavior proof before merge. :: [P2] Cover LM Studio’s initialization readiness lease
  • reviewed 2026-09-24T08:52:07.994Z sha 2b08efb :: needs real behavior proof before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added size: S and removed agents Agent runtime and tooling size: M labels Sep 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: M and removed size: S labels Sep 24, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review the type-scope correction at abbec3271ab950493c073d5020e5b05736109758 (review only; no repair or merge requested).

The recommended memory-specific option is now on MemoryEmbeddingProviderCreateOptions; generic EmbeddingProviderCreateOptions is restored to the exact PR-base file blob 69966befb508a10bb160ea507b878257f1f2b9ec. The existing per-call control is unchanged. The two follow-up commits change only these type declarations (+3/-2 lines), with unchanged emitted JavaScript and a passing extracted strict type-contract probe showing old/new memory options remain mutually assignable. The updated PR body includes source/candidate blob identities and the limits of these static checks.

Real managed cold-start memory_search proof remains unexecuted, and the earlier controlled-acquirer tests are explicitly not represented as that proof. Full project types/tests/CI still need verification on this head. The latest raw GitHub PR response reports mergeable: true but mergeable_state: blocked; this is not a landing or all-green claim.

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 24, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

Closing this candidate because the remaining managed Ollama/LM Studio cold-start proof and public SDK type-scope decision are not currently reachable in an isolated environment. Existing source findings and review evidence remain preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: lmstudio extensions: memory-core Extension: memory-core extensions: ollama P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ollama and LM Studio embedding providers never report ready-local-service waits during memory_search

1 participant