Repository navigation
refactor(memory-lancedb): keep query contracts in schema owner - #196227
Conversation
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR moves shared LanceDB query declarations into the existing schema module and updates the CLI and store imports. Example: Run openclaw ltm query --cols id,text --filter "importance >= 0.8".
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored draft open: the focused refactor preserves existing behavior, and no introduced correctness or security defect was found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe LanceDB plugin CLI parses query options and passes typed requests to MemoryDB, which applies agent-scoped predicates and returns stored memory rows. flowchart LR
User[CLI query options] --> CLI[Memory CLI]
Schema[Shared query declarations] --> CLI
Schema --> Store[MemoryDB]
CLI --> Store
Store --> Table[Agent scoped LanceDB rows]
Table --> Output[JSON results]
Technical reviewBest possible solution: Keep the verbatim declarations in the existing schema owner and complete the draft’s focused consumer and build validation. Do we have a high-confidence way to reproduce the issue? There is no reported runtime bug to reproduce; the original CLI-to-store declaration dependency is directly visible in the pinned base. Is this the best way to solve the issue? The patch is the smallest complete ownership move: it reuses the import-free schema module, updates every identified consumer, and introduces no wrapper or parallel implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e64c3514e419. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3. Total +3 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 November 9, 2026, 3:24 PM ET / 20:24 UTC. |
|
Merged via squash auto-merge.
|
What Problem This Solves
The LanceDB CLI currently imports shared query contracts through the storage implementation.
User Impact
No user-visible behavior change. Query validation, predicates, ordering, null handling and storage lifecycle remain unchanged.
Why This Change Was Made
Move the existing query-column constant and two types verbatim into the existing import-free schema owner. Both CLI and store consume that owner; the CLI retains only a type import of
MemoryDBfrom the store. This replaces one direct CLI-to-store runtime dependency with CLI-to-schema. The plugin entrypoint still reaches the store and Arrow; no startup, bundle, CPU, memory or latency improvement is claimed.No public export, SDK subpath, package metadata, configuration or test change. The three-file diff adds 112 bytes and three LF characters.
Evidence
c4a9104d42654793f88b45c3c42897c619c58060; source base:b299821f3adc50d2810b6707474c41d4ca526d2e.memory-cli,memory-stats,doctor-contract-api,lancedb-store.staleness,arrow-null-predicatesandstartup-imports: 6 files / 35 cases in every preparation and measured invocation.run-tsgo --noEmit, type-awarerun-oxlintfor all three changed modules, both extension import-boundary checks, formatter and normal signed hooks passed.pnpm buildpassed (195.48s wall; 278.66s user / 60.81s system; maximum RSS 6,311,428,096 bytes), including runtime output and public SDK declarations. The emitted CLI imports the query value from schema; the store exposesMemoryDBonly, and the plugin entrypoint still imports the store.plugin-sdk:api:diffagainst the exact source base/head reported no entrypoint or export changes (digestff7b090f43d2d90e4cd883d95840d6b752475a7a1769e295fb4cbb558a6ffb64). Both owner-managed declaration-only installs, renders and temporary-checkout cleanup completed; no API allowance or baseline changed. Comparison cost: 477.02s wall, 828.76s user / 145.64s system, maximum RSS 7,467,794,432 bytes.Test-cost protocol and results
This is the predeclared compiler-warm whole-command set: five serial base/head pairs, each arm receiving one separately timed successful preparation immediately followed by one identical measured invocation. No arm was retried or discarded. The six suites and 35 cases, physical application graph, 626 relevant dependency inputs, runtime and flags matched independently at both revisions. Node 26.13.0 on Darwin arm64, 18 logical CPUs / 128 GiB; observed load 2.79–6.97; inherited heap 4096 MiB and one Vitest worker. Every measured arm showed the normal local compiler cache hit, reused outputs, generation verification/retention and settled cleanup. The first base preparation missed; every later preparation hit. Preparation is not silently excluded from study spend.
Command:
/usr/bin/time -l node scripts/run-vitest.mjsfollowed by the six named suite paths and--maxWorkers=1, with one unchanged task-local filesystem-module-cache path. No compiler/startup/cleanup time was subtracted. Raw rows below are seconds, except RSS in bytes; every row exited zero and passed 6 files / 35 cases.Preparation (separate population)
Measured warm population
All declared median and nearest-rank p95 comparison cells passed the unchanged 20% regression stop. With n=5, p95 is the observed maximum, not a reliable tail estimate. Spread means maximum minus minimum. This is test-cost qualification, not a product latency, startup, memory or CPU improvement claim.
Preparation total: 139.30s wall / 142.08s user / 117.91s system. Measured total: 93.92s wall / 94.74s user / 100.50s system. All timed commands: 233.22s wall / 236.82s user / 218.41s system. Largest individual reported maximum RSS: preparation 7,976,828,928 bytes; measurement 1,157,545,984 bytes; study maximum 7,976,828,928 bytes. Individual maxima are not summed into a simultaneous peak. Phase elapsed time including guards/operator gaps was 989.29s, not test latency. Full raw output and normal cache/lifecycle evidence are retained privately.
Exact-head CI run 42697172546 completed successfully (19 successful jobs / 32 scope skips), including its aggregate gate; the exact-head security review also succeeded. Earlier draft skips remain historical skips.
Normal preparation preserved the reviewed head without another push. The pinned squash request merged that exact head as
cc5c2914c58bde53e0ef708620071213bce06ce8on 2026-11-09 at 21:03:01 UTC. Native ownership-checked cleanup and COMPLETE both succeeded; all owned local commands and streams are joined. Native completion receipt comment. The personal source checkout and proof remain retained; completion did not authorize personal deletion.