Skip to content

refactor(memory): simplify LanceDB embedding lifecycle - #125841

Merged
steipete merged 1 commit into
mainfrom
steipete/memory-lancedb-simplify-7d4c2a
Aug 18, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/memory-lancedb-simplify-7d4c2a

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #125567

What Problem This Solves

Simplifies the lifecycle repair introduced in #125567. The shipped behavior is correct, but provider retirement tracked admitted work both at the service and per-provider-entry levels, and its regression coverage repeated provider fixtures and replacement choreography across suites.

Why This Change Was Made

Provider-entry admission is now the single lifecycle authority. Configuration changes, auth-profile mutation, runtime replacement, and service shutdown all retire entries through one path; each entry has one idle resolver because removal from the provider map gives it one retirement owner. Tests use shared provider/deferred fixtures and leave replacement ordering to the lifecycle suite instead of repeating it in plugin e2e coverage.

User Impact

No user-visible behavior changes. Memory bounds, live embedding credential/endpoint rotation, startup-stable vector identity, per-agent isolation, timeout behavior, and close retry semantics remain unchanged with less lifecycle and test code to maintain.

Evidence

  • node scripts/run-vitest.mjs extensions/memory-lancedb/index.test.ts extensions/memory-lancedb/embeddings.lifecycle.test.ts extensions/memory-lancedb/memory-cli.test.ts extensions/memory-lancedb/lancedb-store.test.ts — 163 tests passed.
  • pnpm test:extension memory-lancedb — 187 tests passed.
  • node scripts/check-changed.mjs -- extensions/memory-lancedb/embeddings.ts extensions/memory-lancedb/embeddings.lifecycle.test.ts extensions/memory-lancedb/index.test.ts — passed.
  • git diff --check — passed.
  • Four-angle simplification review and fresh autoreview reported no remaining actionable findings.
  • Production: +66/-112 (net -46). Tests: +106/-201 (net -95). Total net -141.
  • AI-assisted: yes; the final diff was independently reviewed and verified.

@clawsweeper

clawsweeper Bot commented Aug 18, 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 the extensions: memory-lancedb Extension: memory-lancedb label Aug 18, 2026
@steipete
steipete marked this pull request as ready for review August 18, 2026 13:59
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 18, 2026
@steipete steipete self-assigned this Aug 18, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 10:05 AM ET / 14:05 UTC.

ClawSweeper review

What this changes

This PR makes each cached LanceDB embedding-provider entry own its own retirement wait, consolidates config/auth/replacement shutdown through that path, and removes duplicated lifecycle choreography from plugin end-to-end tests.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. This is a fresh, maintainer-owned lifecycle refactor; current main still has the pre-refactor service-wide admission logic, and no blocking correctness defect was found. Likely related people: steipete (recent owner) and yt2102 (historical lifecycle contributor).

Priority: P3
Reviewed head: 95d29172acecb8af59c166e157e2a81ed29da057

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative lifecycle refactor with source-backed invariants and no actionable review finding; exact-head CI remains the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-owned internal lifecycle refactor, so the external-contributor proof gate does not apply; the PR body records focused lifecycle test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-owned internal lifecycle refactor, so the external-contributor proof gate does not apply; the PR body records focused lifecycle test evidence.
Evidence reviewed 8 items Changed lifecycle owner: The branch removes service-wide admission tracking and makes map removal collect entries for one retirement path; each entry resolves its single idle waiter when its own active use count reaches zero.
Caller and lifecycle boundary: The plugin creates one embeddings owner during registration; its recall and capture paths use that owner, so retirement remains local to the memory-lancedb plugin.
Behavioral lifecycle coverage: Focused lifecycle tests still cover live override rotation, auth-profile rotation, pending creation during service replacement, failed close retry, and draining an admitted request before close.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw plugins list

Result: PASS (completed)

│ Inworld                                  │ inworld                │ openclaw │ enabled  │ /tmp/clawsweeper-live-...sions/inworld/index.ts         │ 2026.8.1 │
│                                          │                        │          │          │ Inworld streaming text-to-speech (MP3, OGG_OPUS, PCM    │          │
│                                          │                        │          │          │ telephony).                                             │          │
│ @openclaw/irc                            │ irc                    │ openclaw │ disabled │ /tmp/clawsweeper-live-...xtensions/irc/index.ts         │ 2026.8.1 │
│ @openclaw/kilocode-provider              │ kilocode               │ openclaw │ enabled  │ /tmp/clawsweeper-live-...ions/kilocode/index.ts         │ 2026.8.1 │
│ @openclaw/kimi-provider                  │ kimi                   │ openclaw │ enabled  │ /tmp/clawsweeper-live-...s/kimi-coding/index.ts         │ 2026.8.1 │
│ LongCat                                  │ longcat                │ openclaw │ enabled  │ /tmp/clawsweeper-live-...sions/longcat/index.ts         │ 2026.8.1 │
│                                          │                        │          │          │ OpenClaw LongCat provider plugin.                       │          │
│ @openclaw/mattermost                     │ mattermost             │ openclaw │ disabled │ /tmp/clawsweeper-live-...ns/mattermost/index.ts         │ 2026.8.1 │
│ @openclaw/meta-provider                  │ meta                   │ openclaw │ enabled  │ /tmp/clawsweeper-live-...tensions/meta/index.ts         │ 2026.8.1 │
│ @openclaw/mistral-provider               │ mistral                │ openclaw │ enabled  │ /tmp/clawsweeper-live-...sions/mistral/index.ts         │ 2026.8.1 │
│ @openclaw/moonshot-provider              │ moonshot               │ openclaw │ enabled  │ /tmp/clawsweeper-live-...ions/moonshot/index.ts         │ 2026.8.1 │
│ MXC Sandbox Execution                    │ mxc                    │ openclaw │ disabled │ /tmp/clawsweeper-live-...xtensions/mxc/index.ts         │ 2026.8.1 │
│                                          │                        │          │          │ OS-level sandboxed tool execution via MXC: runs         │          │
│                                          │                        │          │          │ commands in a Windows ProcessContainer with configured  │          │
│                                          │                        │          │          │ MXC policy files.                                       │          │
│ @openclaw/novita-provider                │ novita                 │ openclaw │ enabled  │ /tmp/clawsweeper-live-...nsions/novita/index.ts         │ 2026.8.1 │
│ @openclaw/opencode-provider              │ opencode               │ openclaw │ enabled  │ /tmp/clawsweeper-live-...ions/opencode/index.ts         │ 2026.8.1 │
│ OpenShell Sandbox                        │ openshell              │ openclaw │ disabled │ /tmp/clawsweeper-live-...ons/openshell/index.ts         │ 2026.8.1 │
│                                          │                        │          │          │ OpenClaw sandbox backend for the NVIDIA OpenShell CLI   │          │
│                                          │                        │          │          │ with mirrored local workspaces and SSH command          │          │
│                                          │                        │          │          │ execution.                                              │          │
│ @openclaw/parallel-plugin                │ parallel               │ openclaw │ disabled │ /tmp/clawsweeper-live-...ions/parallel/index.ts         │ 2026.8.1 │
│ @openclaw/perplexity-plugin              │ perplexity             │ openclaw │ disabled │ /tmp/clawsweeper-live-...ns/perplexity/index.ts         │ 2026.8.1 │
│ PixVerse                                 │ pixverse               │ openclaw │ enabled  │ /tmp/clawsweeper-liv
… output truncated …

Assertions:

  • PASS expect_output: memory-lancedb

How this fits together

The LanceDB memory plugin obtains an embedding provider per agent to vectorize stored and recalled memories. When config or auth changes, the provider lifecycle waits for admitted work, closes the old client, and allows the replacement to serve later requests.

flowchart LR
  A[Memory request] --> B[Per-agent provider entry]
  B --> C[Embedding request]
  D[Config or auth change] --> E[Retire cached entry]
  C --> F[Entry becomes idle]
  E --> F
  F --> G[Close old provider]
  G --> H[Create replacement provider]
Loading

Before merge

  • Resolve merge risk (P1) - This changes the retirement path used during live credential/config rotation; a regression could retain a stale provider or close an admitted embedding request. The branch is behind main and its exact-head checks were still in progress in the provided context.
Agent review details

Security

None.

PR surface

Source -46, Tests -95. Total -141 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 66 112 -46
Tests 2 106 201 -95
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 172 313 -141

Review metrics

Metric Value Why it matters
Production versus test LOC production +66/-112 (net -46); tests +106/-201 (net -95) The refactor materially reduces both lifecycle implementation and duplicated test setup while retaining focused ownership coverage.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-lancedb/embeddings.lifecycle.test.ts, unknown-data-model-change: extensions/memory-lancedb/embeddings.ts, unknown-data-model-change: extensions/memory-lancedb/index.test.ts, vector/embedding metadata: extensions/memory-lancedb/embeddings.lifecycle.test.ts, vector/embedding metadata: extensions/memory-lancedb/embeddings.ts, vector/embedding metadata: extensions/memory-lancedb/index.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete exact-head lifecycle validation (recommended)
    Accept the provider-auth lifecycle risk after the current head's focused lifecycle checks confirm config and credential rotation preserve admitted work before replacement.

Technical review

Best possible solution:

Keep retirement ownership per provider entry and merge only after exact-head lifecycle validation confirms replacement waits for admitted work and retries failed closes.

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

Not applicable: this is a behavior-preserving refactor, and the relevant invariant is exercised by focused lifecycle coverage rather than a new user report.

Is this the best way to solve the issue?

Yes. Entry-scoped retirement matches the provider-map ownership boundary and preserves the existing rotation and close-retry contract without adding configuration or a parallel lifecycle.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6a97ba4f8b6f.

Labels

Label changes:

  • add P3: This is a behavior-preserving maintenance refactor with no reported user-facing regression.
  • add merge-risk: 🚨 auth-provider: The changed path retires provider clients when live embedding credentials or auth profiles change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-owned internal lifecycle refactor, so the external-contributor proof gate does not apply; the PR body records focused lifecycle test evidence.

Label justifications:

  • P3: This is a behavior-preserving maintenance refactor with no reported user-facing regression.
  • merge-risk: 🚨 auth-provider: The changed path retires provider clients when live embedding credentials or auth profiles change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-owned internal lifecycle refactor, so the external-contributor proof gate does not apply; the PR body records focused lifecycle test evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Auth-isolation and the related merged reload repair were authored in this area, and the current refactor follows that work. (role: recent lifecycle owner; confidence: high; commits: 95e17d6c993f, b68d13a0f095; files: extensions/memory-lancedb/embeddings.ts, extensions/memory-lancedb/embeddings.lifecycle.test.ts)
  • yt2102: Earlier merged provider-replacement lifecycle work is recorded in the embedding-owner history. (role: historical lifecycle contributor; confidence: medium; commits: 6bd8e0387c17; files: extensions/memory-lancedb/embeddings.ts)

Rank-up moves

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

  • Wait for the focused exact-head checks to finish green before merging.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for exact head 95d29172acecb8af59c166e157e2a81ed29da057:

  • Exact-head CI: run 32145591102 completed successfully.
  • node scripts/run-vitest.mjs extensions/memory-lancedb/index.test.ts extensions/memory-lancedb/embeddings.lifecycle.test.ts extensions/memory-lancedb/memory-cli.test.ts extensions/memory-lancedb/lancedb-store.test.ts — 163/163 passed.
  • pnpm test:extension memory-lancedb — 187/187 passed.
  • node scripts/check-changed.mjs -- extensions/memory-lancedb/embeddings.ts extensions/memory-lancedb/embeddings.lifecycle.test.ts extensions/memory-lancedb/index.test.ts — complete changed gate passed.
  • git diff --check origin/main...HEAD — passed.
  • .claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main — clean; no accepted/actionable findings.
  • ClawSweeper reviewed this exact head, found no actionable correctness or security findings, and called the entry-scoped retirement owner the best solution. Its sole Rank-up move was to wait for exact-head checks; that is satisfied by the green CI run above.
  • Behavior remains unchanged: memory bounds, admitted-request drain ordering, direct apiKey/baseUrl rotation, provider retirement, startup-stable provider/model/dimensions, auth/runtime replacement, per-agent isolation, pending creation, timeouts, failed-close retry, and CLI close semantics remain covered. Direct external-provider proof is not needed for this deletion-only lifecycle simplification; the direct-client path is untouched.
  • LOC: production +66/-112 (net -46); tests +106/-201 (net -95); total +172/-313 (net -141).

No known proof gap or unresolved review finding remains.

@steipete
steipete merged commit 2c5a694 into main Aug 18, 2026
168 checks passed
@steipete
steipete deleted the steipete/memory-lancedb-simplify-7d4c2a branch August 18, 2026 14:21
@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 merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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