Repository navigation
fix(memory): bound LanceDB prompts and reload embedding config - #125567
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 1:35 AM ET / 05:35 UTC. ClawSweeper reviewWhat this changesThe PR bounds LanceDB memory text shown to the model, rejects oversized manual memory writes, and refreshes embedding credentials or endpoints for subsequent memory operations without restarting the Gateway. Merge readinessKeep this active maintainer PR open. The revised head addresses the prior index-identity blocker by applying only live credential/endpoint changes while retaining the startup provider, model, and dimensions; no blocking patch defect was found. It remains behind current main with exact-head checks incomplete. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe LanceDB memory plugin embeds stored memories and returns recalled text to memory tools or automatic prompt injection. Live plugin config feeds the embedding client, while the persisted LanceDB vector table requires a stable semantic identity. flowchart LR
A[Memory tools and hooks] --> B[Live plugin configuration]
B --> C[Memory bounds and identity check]
C --> D[Embedding client or provider]
D --> E[LanceDB vector table]
E --> F[Recall results]
F --> G[Tool response or model context]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +102, Tests +288, Docs +14. Total +404 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep prompt bounds in the shared memory-policy formatter and connection rotation in the embedding owner, while retaining startup vector identity until an explicit rebuild path exists. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main builds the embedding client once at registration and emits unbounded recalled rows, while the head routes each operation through live config and a shared output bound. The read-only review did not execute the reported runtime probe. Is this the best way to solve the issue? Yes. The patch fixes the producer and presentation owners rather than rebuilding the database or adding a downstream guard, and it explicitly blocks live semantic-index changes that would invalidate existing vectors. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 31afd52e997b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Addressed the ClawSweeper findings on the new head:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready evidence for
|
…law#125567) * fix(memory): bound LanceDB recall and reload embeddings * fix(memory): preserve LanceDB index identity
What Problem This Solves
Fixes two memory-lancedb failures that persisted across sessions and hot configuration updates. A memory written through
memory_storecould be arbitrarily large, so one legacy or tool-stored row could dominate recall output and automatic prompt injection. Separately, rotating the plugin's embedding credential or endpoint at runtime left the register-time client active until the Gateway restarted.Why This Change Was Made
The plugin now rejects
memory_storetext above the livecaptureMaxCharslimit before embedding or persistence, and bounds each escaped model-visible recalled item with the liverecallMaxCharslimit across explicit recall, automatic recall, and forget confirmations. Stored rows and structured recall details remain unchanged.Embedding calls now carry the validated live connection settings into the embedding owner.
embedding.apiKeyandembedding.baseUrlrotate live, while provider, model, and dimensions remain startup-stable because they define the persisted LanceDB vector-index identity. Provider-backed clients reuse the existing per-agent retirement lifecycle so admitted work drains before stale providers close and replacements start.User Impact
Oversized memories can no longer silently inflate future prompts, and existing oversized rows are shown only within the configured recall bound. Operators can rotate a leaked embedding key or move the same embedding identity to another endpoint and have the next memory operation use it without restarting the Gateway. Provider, model, or dimension changes require a planned LanceDB re-embedding/rebuild before restart; the plugin does not rewrite existing vectors automatically.
Evidence
memory_storecompleted instead of rejecting, recall/auto-recall leaked the oversized tail, and runtime key/endpoint changes kept using the old client.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.pnpm docs:check-mdx && pnpm docs:check-links— passed with 0 broken links.node scripts/check-changed.mjs -- docs/plugins/memory-lancedb.md extensions/memory-lancedb/config.ts extensions/memory-lancedb/embeddings.lifecycle.test.ts extensions/memory-lancedb/embeddings.ts extensions/memory-lancedb/index.test.ts extensions/memory-lancedb/index.ts extensions/memory-lancedb/lancedb-store.test.ts extensions/memory-lancedb/memory-cli.test.ts extensions/memory-lancedb/memory-cli.ts extensions/memory-lancedb/memory-policy.ts extensions/memory-lancedb/openclaw.plugin.json— passed.