Skip to content

fix(memory-lancedb): stop timed-out recall before returning results - #124143

Merged
steipete merged 1 commit into
mainfrom
fix/autoqa-refill-lancedb-timeout-v2
Aug 15, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/autoqa-refill-lancedb-timeout-v2

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #124118

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where a LanceDB-backed recall that reached its 15-second deadline during native vector search could return from the outer timeout while the native query kept running, or accept a vector result that completed at the deadline. The abandoned query consumed work after recall had ended and could later produce a stale success.

Why This Change Was Made

One absolute recall deadline now owns embedding plus vector search. Embedding receives only the remaining budget, and LanceDB receives the same remaining budget through its native QueryExecutionOptions.timeoutMs owner. The outer race still preserves the existing tool and prompt-hook outcomes, but a completion at or after the deadline is classified as a timeout.

This is the LanceDB-native sibling of #124118, not a second Memory Core cancellation path. Memory Core can propagate AbortSignal through its JavaScript/SQLite owner; pinned LanceDB 0.31 exposes query cancellation through timeoutMs instead:

The plugin pins exactly @lancedb/lancedb 0.31.0. Search timeouts remain health-neutral and retry on the next recall; embedding timeouts retain the existing shared cooldown policy.

User Impact

Timed-out explicit and automatic LanceDB recall no longer accepts a late vector result, and native search receives a cancellation deadline instead of continuing without an owner. A later healthy recall continues to work on the same database. There is no provider auth/routing, configuration/default, storage/schema/migration, SDK/protocol, release, or deployment change.

No docs change is needed because this repairs the existing fixed recall deadline without adding an operator-facing setting or workflow. No changelog file is added because normal PR changelogs are release-owned; this body records the release-note context.

Evidence

  • Real native Testbox proof with 120,000 LanceDB rows: the pre-fix-equivalent unbounded query lost the 1 ms outer race, then returned stale success at 21 ms. The repaired native query rejected with Query timeout after 1 ms at 3 ms, the composed absolute deadline returned timeout at 1 ms, and a subsequent healthy query succeeded.
  • Focused and sibling tests: 145/145 passed (142 memory-lancedb plugin tests and 3 real native store tests), including exact-deadline late success, native query timeout/reuse, tool result behavior, automatic recall behavior, and embedding-only cooldown policy.
  • Testbox run: https://github.com/openclaw/openclaw/actions/runs/31877968249
  • Exact-head changed gate passed: format, extension production/test types, changed-file lint with 0 warnings/errors, unskipped dead-code scans, plugin/dependency/database-first/sidecar guards, and 0 runtime import cycles.
  • Full production build passed: all compiler invocations, runtime postbuild, 145 public Plugin SDK declaration subpaths, and Control UI production build.
  • Fresh Codex autoreview: clean, no accepted/actionable findings; patch-correct confidence 0.97.
  • git diff --check: clean.
  • Production LOC: +23/-10 (net +13). Tests: +49/-0. The production growth is the absolute-deadline handoff, native LanceDB execution option, and deadline classification at the existing owner; it adds no parallel timeout policy or compatibility path.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-lancedb Extension: memory-lancedb size: S maintainer Maintainer-authored PR labels Aug 15, 2026
@steipete steipete self-assigned this Aug 15, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for fa6ff24002afa7ce71f96c1209f4a89d01a919e9:

  • Root cause: the plugin's outer recall timeout raced the task, but vector search called LanceDB without native execution options, so a deadline could return while native search continued and an exact-deadline completion could be accepted.
  • Architectural owner and canonical fix: memory-lancedb owns this recall path. One absolute deadline now spans embedding plus native search, with remaining time passed through pinned LanceDB 0.31 QueryExecutionOptions.timeoutMs. The sibling Memory Core AbortSignal fix in fix(memory): stop cancelled searches before returning results #124118 remains separate because LanceDB exposes native timeout rather than that signal contract.
  • Real native proof: with 120,000 rows, the unbounded baseline lost a 1 ms outer race and returned stale success at 21 ms; native timeout rejected with Query timeout after 1 ms at 3 ms; the composed deadline returned timeout at 1 ms; the subsequent healthy query succeeded.
  • Focused/sibling proof: 145/145 passed. Search-timeout behavior remains health-neutral; embedding timeout retains the existing shared cooldown contract for both the tool and automatic recall.
  • Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/31878588844
  • Hosted native/focused/changed/build proof: https://github.com/openclaw/openclaw/actions/runs/31877968249
  • Full changed gate, full production build, format, lint, production/test types, deadcode, dependency/storage/sidecar guards, and 0 runtime import cycles passed. Fresh structured autoreview is clean with no findings and 0.97 confidence.
  • Production LOC: +23/-10 (net +13). Tests: +49/-0. The remaining growth is the absolute-deadline handoff, native execution option, and deadline classification at the existing owner; no duplicate timeout policy, fallback, or compatibility path was added.
  • No docs or changelog file: this repairs the existing fixed deadline without an operator-facing setting or workflow, and the PR body carries release-note context.
  • No provider auth/routing/config/default, storage/schema/migration, SDK/protocol, release, deployment, or unrelated repair.

Native review artifacts validate as READY FOR /prepare-pr with zero findings. The latest ClawSweeper comment is still the received placeholder and publishes no Rank-up moves: list; its exact dispatch completed successfully. There are therefore no published moves to apply or skip, and repository policy does not block landing on a late publisher.

@steipete
steipete merged commit dec4d44 into main Aug 15, 2026
106 checks passed
@steipete
steipete deleted the fix/autoqa-refill-lancedb-timeout-v2 branch August 15, 2026 10:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: memory-lancedb Extension: memory-lancedb maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant