Repository navigation
fix(memory): report managed local-service readiness from the Ollama and LM Studio embedding providers - #156483
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: needs maintainer review before merge. Reviewed October 8, 2026, 1:23 AM ET / 05:23 UTC (Revision 10). ClawSweeper reviewWhat this changesThe Ollama and LM Studio embedding providers report managed startup waits so memory search preserves its remaining search budget until the service is ready. Example: Run memory_search while managed Ollama takes 40 seconds to restart.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful and has sufficient real behavior proof, with no actionable code or security findings. The previous PR-body heading blocker is resolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherMemory search asks embedding providers to turn queries into vectors for semantic retrieval. These adapters acquire a managed local service before sending embedding requests and notify the existing search deadline owner while waiting for readiness. flowchart TD
A[Memory search] --> B[Search deadline owner]
A --> C[Ollama or LM Studio adapter]
C --> D[Managed service acquisition]
D --> E{Service ready?}
E -->|Waiting| B
E -->|Ready| F[Embedding HTTP request]
F --> G[Semantic search results]
Technical reviewBest possible solution: Use the existing readiness and deadline owners consistently across all three embedding adapters while retaining request deadlines, cancellation, and service leases. Do we have a high-confidence way to reproduce the issue? Yes: current-main source shows both adapters omit readiness reporting, and the supplied Gateway red/green runs demonstrate premature search timeout during a 40-second managed startup. This read-only review did not execute target code. Is this the best way to solve the issue? Yes: the patch connects the missing adapters to the existing readiness-budget contract without introducing another lifecycle or deadline owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d51917edde3d. Provenance checked
TestingProof path: shipped entry point. Added test files: 0. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +80. Total +80 across 2 files. View PR surface stats
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. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (9 earlier review cycles; latest 8 shown)
|
|
Both items addressed. P2 type finding — correct, and I had wrongly claimed otherwise. Both extensions declare their own Real behavior proof through the actual acquisition owner — added, replacing the stub-only evidence. Unchanged production: This head: Identical ~1.6 s cold start with four health polls in both runs; only the budget outcome differs. Nothing is stubbed — child process, health endpoint, acquisition owner, and deadline control are all real. Still not established: no live Ollama/LM Studio model server and no embedding request to a real model. What is proven is the readiness-signal routing. The PR body is updated. |
|
Re your proof gate: stronger end-to-end evidence added, replacing the stub harness. The managed local service is now a real child process spawned by the real acquisition owner, and that child is itself an HTTP server that mimics Ollama's endpoints — 503 on Unchanged production: This head: Both runs complete the whole path — child spawn, real readiness polling, real HTTP embedding round trip — and return the same vector, normalized by the provider's L2 step from the Remaining honest gap: no inference ran and there is no live external Ollama/LM Studio install. lmstudio is covered at stub level plus source inspection; its call site is structurally identical to Ollama's. Type fix from the earlier review is in |
|
LM Studio real-behavior proof added, closing the remaining gap from the Revision 2 review. Same harness shape as the accepted Ollama proof, now driving the LM Studio adapter. The managed local service is a real child process spawned by the real acquisition owner ( This head ( Unchanged production (merge-base The budget really expires during the cold start on current main ( Re-verified Ollama at the same time on this head (fresh runs, not reused output): and its red side fails at the same expiry assertion ( Per-file wall times: Remaining honest gap: no inference ran and there is no live external Ollama/LM Studio install; what is proven end to end is the readiness-signal routing plus the real embedding transport for both adapters. |
e46e629 to
bba8761
Compare
|
Rebased onto current main ( Conflict resolutionThe conflicts were import-block collisions with the two provider deslop passes (#158403, #160038) plus test-file cleanups (#158714, #158907):
Byte-level check of the resolved head vs the reviewed head Validation on the resolved head (2026-09-29, UTC)
Ollama: LM Studio: Both runs end with a clean managed shutdown ( Data-model compatibilityNo stored-data contract changes: the patch only touches the provider call path (readiness callback wiring) and tests. No persisted state, config schema, or migration surface is affected, so migration/upgrade compatibility is unchanged. Ready for re-review. |
…nd LM Studio embedding providers `memory_search` gives managed service startup its own `readyTimeoutMs` budget so a cold local service does not consume the search deadline. The deadline owner pauses and resumes that budget from `ProviderLocalServiceTarget.onReadinessWait`, and the shared OpenAI-compatible embedding provider builds that callback from the `MEMORY_SEARCH_DEADLINE_CONTROL` symbol it receives in its call options. The bundled Ollama and LM Studio embedding providers passed their stored local-service target to `acquireLocalService` unchanged, so the optional `onReadinessWait` property was absent and the owner's `target.onReadinessWait?.(...)` degraded to a no-op. A managed cold start on either provider therefore still ran against the whole search deadline. Both providers now read the same symbol from their embedding call options and report the wait, matching the shared provider. When no deadline control is present the target is passed through unchanged, so direct embedding calls are unaffected. Co-Authored-By: Claude Code <[email protected]>
…get types
Both extensions declare their own `MemoryCoreAcquireLocalService` whose target
type stopped at `{ providerId, baseUrl, headers? }`. The new inline object adds
`onReadinessWait`, which is an excess-property error against that narrower
contract (TS2353 at ollama:433 and lmstudio:269).
The canonical `ConfiguredProviderLocalServiceTarget` in core already declares the
optional callback, but it is not exposed through the plugin SDK, so the extension
contracts carry it instead.
Co-Authored-By: Claude Code <[email protected]>
bba8761 to
529397a
Compare
|
@clawsweeper re-review Rebased both commits onto current Conflicts were import/type-declaration drift in
Local verification on the rebased head:
|
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 6dd7b2e. Thanks @wangmiao0668000666! Verified on a built Gateway: with a 40 s cold start, memory_search now returns results from both Ollama and LM Studio instead of timing out at 30 s. |
|
Thanks for the review and for landing this, @obviyus! Really appreciate you reproducing it on a built Gateway with a 40 s cold start — confirming that Happy to follow up if related local-service readiness edges come up. |
…nd LM Studio embedding providers (openclaw#156483) Have the Ollama and LM Studio embedding providers report managed local-service readiness, so memory search waits for a cold-starting local service instead of timing out at the default 30 s budget. Fixes openclaw#156359. Co-authored-by: Claude Code <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Fixes #156359
What Problem This Solves
Managed Ollama and LM Studio embedding startup consumed
memory_search's 30-second deadline even though startup has its ownlocalService.readyTimeoutMsbudget. Both adapters now report readiness waits to the existing memory deadline owner, matching the shared OpenAI-compatible adapter. Embedding requests retain their normal deadline after readiness; warm and unmanaged services are unchanged.Thanks to @wangmiao0668000666 for the fix and to the reporter of #156359 for identifying the uncovered adapters. The contributor's commits are preserved.
Evidence
Tested through the built Gateway's authenticated
POST /tools/invokeendpoint with the realmemory_searchtool, real indexing, managed child-process startup, and loopback HTTP services implementing Ollama/api/embedand LM Studio/v1/embeddings. Each service was warm, stopped, and restarted with a 40-second readiness delay and a 65-second readiness budget. No internal acquisition or deadline callback was mocked.a6a353a790edtimedOut: true, partial keyword-only resultsvectorScore: 1, no timeouttimedOut: true, partial keyword-only resultsvectorScore: 1, no timeoutWarm searches passed on both revisions. Subsequent candidate queries completed in 47 ms and 73 ms respectively. On the baseline, another slow restart still timed out; resetting startup delay to zero restored semantic retrieval for both providers. LM Studio used the supported
params.preload: falseconfiguration to keep readiness acquisition on the query path.This verifies the linked issue's readiness-budget bug, not a status-display change. The loopback services return deterministic vectors; no local model weights or external Ollama/LM Studio installation were exercised.
Checks
pnpm tsgo:extensions: passed with the real repository native TypeScript checker in secretless Docker.node scripts/run-vitest.mjs extensions/ollama/src/embedding-provider.test.ts extensions/lmstudio/src/embedding-provider.test.ts --maxWorkers=1: 52 passed, 25.31 s Vitest duration / 26.70 s shard wall time.gpt-5-miniagent turn through the built CLI: reasoninglow, output budget 4096, returnedREADY(one assistant turn, no tool calls).Compatibility and merge risk
No schema, stored-data, configuration, permission, or published API change. Two-way door: reverting restores the previous timeout behavior without a migration. Blast radius is memory embeddings through managed Ollama and LM Studio services; an incorrect change could pause or resume their memory search deadlines incorrectly.