Repository navigation
fix(memory-lancedb): stop expired recalls after cold provider startup - #182340
Conversation
Keep provider initialization and embedding dispatch on the same caller deadline. Do not send an expired prompt after shared initialization finishes, and abort active embedding requests using only the remaining budget. Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 4e8a5a89-1d7e-41bb-83b8-6343a27b2913
|
🦞👀 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. |
|
Merged via squash.
|
|
Codex review: needs maintainer review before merge. What this changesThe PR counts cold embedding-provider initialization against recall’s existing timeout and refuses expired embedding requests. Example: An automatic recall has a 15-second budget and provider initialization takes 16 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a concrete deadline defect still present on main, preserves provider lifecycle ownership, and introduces no actionable correctness findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherLanceDB automatic recall and memory_recall pass queries through the embedding adapter, then use the resulting vectors for database search under a shared deadline. flowchart TD
A[Prompt hook or memory_recall] --> B[Recall deadline]
B --> C[Shared provider initialization]
C --> D[Remaining budget check]
D --> E[Bounded embedding request]
E --> F[LanceDB search]
D --> G[Expired recall skipped]
Technical reviewBest possible solution: Keep the deadline calculation in the existing adapter while preserving shared provider initialization and retirement. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the timeout extension, and the supplied registered-hook regressions exercise both failure modes; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete repair: measure elapsed initialization in the existing adapter, reject expired dispatch, and retain the existing timer and lifecycle owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b56729ef5e76. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests +112, Docs +7. Total +125 across 3 files. Added test files: 1. View PR surface stats
LabelsLabel 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 Reviewed October 24, 2026, 3:20 AM ET / 07:20 UTC. |
…openclaw#182340) * fix(memory-lancedb): stop expired recalls after cold provider startup Keep provider initialization and embedding dispatch on the same caller deadline. Do not send an expired prompt after shared initialization finishes, and abort active embedding requests using only the remaining budget. Co-authored-by: steipete <[email protected]> * fix(memory-lancedb): stop expired recalls after cold provider startup Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 4e8a5a89-1d7e-41bb-83b8-6343a27b2913 --------- Co-authored-by: steipete <[email protected]>
…#182340) * fix(memory-lancedb): stop expired recalls after cold provider startup Keep provider initialization and embedding dispatch on the same caller deadline. Do not send an expired prompt after shared initialization finishes, and abort active embedding requests using only the remaining budget. Co-authored-by: steipete <[email protected]> * fix(memory-lancedb): stop expired recalls after cold provider startup Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 4e8a5a89-1d7e-41bb-83b8-6343a27b2913 --------- Co-authored-by: steipete <[email protected]> Beta.5 baseline adaptation: Include required cold-start deadline producer and its deferred-provider regression before the follow-up monotonic correction. (cherry picked from commit 5dda1e2) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit eec451802784c1f4a92ccf00707b902dcd1d0623)
…#182340) * fix(memory-lancedb): stop expired recalls after cold provider startup Keep provider initialization and embedding dispatch on the same caller deadline. Do not send an expired prompt after shared initialization finishes, and abort active embedding requests using only the remaining budget. Co-authored-by: steipete <[email protected]> * fix(memory-lancedb): stop expired recalls after cold provider startup Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 4e8a5a89-1d7e-41bb-83b8-6343a27b2913 --------- Co-authored-by: steipete <[email protected]> (cherry picked from commit 5dda1e2) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 933736e978a5e48cfeee14d2d9ba417017268d89)
…o the fork's 5 s budget beta.5 added "includes %ims of cold provider initialization in the auto-recall deadline" (openclaw#182340, openclaw#186037) with cases 10_000 and 16_000 around upstream's 15_000 ms auto-recall budget. The fork keeps auto-recall at 5_000 ms (auto-recall.ts AUTO_RECALL_TIMEOUT_MS), so the 10_000 case expected a request the fork never makes: it failed 3 of 3 alone on the carry and passed 3 of 3 on bare beta.5. The cases now straddle 5_000 (3_000 inside, 6_000 past), and the remaining-budget advance uses 5_000. The test still checks that cold initialization counts against the deadline: the 3_000 case expects the request aborted at 5 s total, not 5 s after the provider is ready. Control: with AUTO_RECALL_TIMEOUT_MS set back to 15_000, both adapted cases fail.
What Problem This Solves
Fixes expired LanceDB recall queries starting or continuing after the caller has timed out when a cold embedding provider initializes slowly.
User Impact
User impact: automatic recall and
memory_recallno longer give provider-adapter embedding requests a fresh timeout after cold initialization consumes their existing 15-second budget. The direct OpenAI-client path is unchanged; no configuration, stored-data, or migration changes are required.Why This Change Was Made
Capture the adapter call's deadline before awaiting shared provider initialization, reject an expired query before dispatch, and give the existing abort timer only the remaining budget. Shared initialization may still finish for later operations; the provider creation API has no caller cancellation signal, and this change preserves shared provider ownership and retirement.
Evidence
before_prompt_buildhook, real embedding-adapter/registry lookup, and a synthetic cold local provider. Both regressions fail on base0a9d5cc49d911e587e78a0bc5600038a8d97f431: after 10 seconds of initialization, the request remains active at 15 seconds; after 16 seconds of initialization, an already-expired prompt is dispatched. Both pass with this repair.git diff --checkpassed.Errorfor lint, then the regression and scoped checks passed again.Requested and directed by @steipete; the commit preserves the verified steipete coauthor credit.
Work sessions
Worked on by