Skip to content

fix(memory-lancedb): stop expired recalls after cold provider startup - #182340

Merged
roboclaw-bot merged 2 commits into
mainfrom
openclaw/memory-deadline-reliability
Oct 24, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
openclaw/memory-deadline-reliability

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

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_recall no 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

  • Reproduced through plugin registration, its registered service start and before_prompt_build hook, real embedding-adapter/registry lookup, and a synthetic cold local provider. Both regressions fail on base 0a9d5cc49d911e587e78a0bc5600038a8d97f431: 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.
  • 64 focused tests passed across automatic recall, recall privacy, embedding lifecycle, and plugin suites. The final two-case regression takes 32 ms of test time and 41.42 seconds wall time, dominated by cold worker compilation; CI timing is not yet available.
  • Targeted production and regression typechecks, type-aware lint, formatting, docs formatting, and git diff --check passed.
  • Independent Codex autoreview found no actionable P0–P2 issues; the only subsequent change made the test fixture reject an Error for lint, then the regression and scoped checks passed again.
  • Limits: no full Gateway/model boot or real GGUF/provider service was exercised. This is registered-plugin boundary proof, not a live-provider or full-Gateway claim. Late shared initialization remains intentionally allowed, but expired query dispatch is refused. The direct OpenAI-client path was not changed.

Requested and directed by @steipete; the commit preserves the verified steipete coauthor credit.

Work sessions

Worked on by

roboclaw-bot and others added 2 commits October 24, 2026 06:45
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
@clawsweeper

clawsweeper Bot commented Oct 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-lancedb Extension: memory-lancedb size: S labels Oct 24, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 24, 2026 07:04
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@roboclaw-bot
roboclaw-bot merged commit 5dda1e2 into main Oct 24, 2026
176 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/memory-deadline-reliability branch October 24, 2026 07:20
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The expired recall dispatches an embedding request with another 15-second timeout.
  • After: The adapter rejects the expired recall without dispatching its embedding request.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct repair with meaningful boundary regressions and green exact-head checks; behavioral evidence remains limited to an in-process synthetic-provider harness.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored bot PR is outside the ordinary contributor proof gate; its supplied evidence exercises the real recall adapter through a registered hook with a synthetic provider and fake clock, and explicitly disclaims live-provider or Gateway coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Timed-out memory recall can still send the old query to an embedding provider or continue its request beyond the original budget.
Reason: This maintainer-authored repair restores the existing deadline contract without adding options, changing provider selection, or rewriting stored data.

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
Reviewed head: daa59c8692bd15d3972dfe81fe9f701382451016

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied registered-hook tests do not demonstrate cold startup and cancellation through a running Gateway with a real embedding provider.
Agent review details

How this fits together

LanceDB 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]
Loading

Technical review

Best 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

  • Provider admission, initialization, and embedding timeout keeps the original intent (2c5a694: The lifecycle refactor made provider-entry admission authoritative and preserved existing timeout behavior; the PR repairs deadline accounting without replacing that ownership.)
  • Canonical embedding provider calls keeps the original intent (67d22a5: The provider-contract refactor removed private translation layers while preserving provider-owned behavior and public API shapes.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned production change: The introduced diff captures the deadline before awaiting provider creation, rejects nonpositive remaining time, and reuses the existing abort timer with the remaining budget; admission and retirement are unchanged. (extensions/memory-lancedb/embeddings.ts:310, daa59c8692bd)
  • Current-main defect: Current main awaits entry.promise before starting the full embedding timeout; startMemoryRecall already supplies the remaining caller budget, so cold initialization incorrectly extends request lifetime. (extensions/memory-lancedb/embeddings.ts:315, b56729ef5e76)
  • Distinct regression coverage: The registered-plugin tests cover initialization completing at 10 seconds with abortion at the original 15-second deadline, and initialization completing at 16 seconds with no embedding dispatch; the PR reports both failing on base and passing after the fix. (extensions/memory-lancedb/auto-recall.deadline.test.ts:18, daa59c8692bd)
  • Lifecycle intent: The merged lifecycle refactor refactor(memory): simplify LanceDB embedding lifecycle #125841 established provider-entry admission as the lifecycle authority; the canonical provider contract in refactor(embeddings): unify provider contract #130506 exposes cancellation for embedding calls but no cancellation signal for provider creation. (src/plugins/embedding-provider-types.ts:88, daa59c8692bd)
  • Exact-head checks: Paginated checks for the reviewed head contain only successful or skipped conclusions, including a successful openclaw/ci-gate; dependency-review, security-sensitive-review, and CI status contexts are successful. (daa59c8692bd)
  • Policy and history inspection: Read the full root, extensions, and docs guidance; no deeper ancestor guidance or maintainer-notes directory exists for these paths. Feature history identifies the lifecycle contributors, although a scoped pickaxe search encountered an unavailable historical blob; introduction beyond verified history remains unknown. (AGENTS.md:1, b56729ef5e76)

Likely related people:

  • Peter Steinberger: Raw commit 2c5a694 adds extensions/memory-lancedb/embeddings.ts:375 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2c5a694ccb1a; files: extensions/memory-lancedb/embeddings.ts)
  • yt2102: Raw commit 6bd8e03 adds extensions/memory-lancedb/embeddings.ts:300 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 6bd8e0387c17; files: extensions/memory-lancedb/embeddings.ts)

PR surface

Source +6, Tests +112, Docs +7. Total +125 across 3 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 8 2 +6
Tests 1 112 0 +112
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 127 2 +125

Labels

Label changes:

  • add P2: Cold provider startup can cause unnecessary embedding work after recall expires, with limited impact on the optional LanceDB recall path.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Cold provider startup can cause unnecessary embedding work after recall expires, with limited impact on the optional LanceDB recall path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 3:20 AM ET / 07:20 UTC.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…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]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…#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)
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…#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)
amittell added a commit to amittell/openclaw that referenced this pull request Nov 1, 2026
…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.
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-lancedb Extension: memory-lancedb P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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