Repository navigation
feat(memory): memory search on PostgreSQL - #174242
Conversation
Route internal memory search through admitted PostgreSQL vector and text capabilities while preserving the public refusal and SQLite query paths. Rank trigram matches before limiting, and cover worker conformance, restart admission, and SQLite statement compatibility.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesAdds internal PostgreSQL memory vector, keyword, and path queries while preserving public refusal and SQLite behavior. Example: An internal conformance query searches PostgreSQL memory for "cafe".
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this PR supplies a coherent, maintainer-approved stage of PostgreSQL memory support, with no definite introduced defect found; CI remains unresolved. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherMemory Core sends retrieval requests to its search worker, which uses admitted engine search capabilities and returns bounded ranked chunks for shared result merging. flowchart TD
A[Memory search caller] --> B[Search worker]
B --> C[Public admission guard]
B --> D[Explicit internal activation]
C --> E[SQLite retrieval]
D --> F[PostgreSQL query adapter]
F --> G[Admitted text and vector indexes]
E --> H[Ranked chunk results]
G --> H
Technical reviewBest possible solution: Retain the staged engine-backed query adapter and preserve public refusal until the complete search, status, and forget lifecycle is ready. Do we have a high-confidence way to reproduce the issue? This is staged feature work rather than a bug report; source confirms that current main refuses PostgreSQL memory search. Is this the best way to solve the issue? The adapter uses existing engine capabilities and shared query planning without adding a persistence owner or changing SQLite retrieval. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 05bac14d1d45. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +379, Tests +566, Docs +13, Other +2. Total +960 across 12 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
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 October 16, 2026, 9:45 AM ET / 13:45 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* feat(memory): add PostgreSQL worker search Route internal memory search through admitted PostgreSQL vector and text capabilities while preserving the public refusal and SQLite query paths. Rank trigram matches before limiting, and cover worker conformance, restart admission, and SQLite statement compatibility. * chore(memory): record PostgreSQL search worker ownership * fix(memory): decouple worker search query types
What Problem This Solves
Adds the PostgreSQL memory search query path on top of #174085 and #174183, so admitted memory projections can be exercised through the existing search worker before public activation.
User Impact
No public behavior change. PostgreSQL memory search still refuses at public admission; only the internal conformance entry explicitly activates these queries. SQLite search and the shared hybrid merge remain unchanged.
Why This Change Was Made
The memory worker uses the engine's exact pgvector cosine query with model, source, and candidate eligibility before ordering and limit. Text and path queries use native full text or literal trigram predicates, with bounded result payloads and no per-query corpus transfer to JavaScript. Trigram candidates rank by native word similarity before limiting; multi-term queries average their term scores. Hybrid merging retains the default 0.7 vector / 0.3 text weights; PostgreSQL text scores stay engine-local.
A keyword-only store needs no pgvector extension. Missing vector admission raises
DATABASE_SEARCH_CAPABILITY_UNAVAILABLE, including a semantic request against a keyword-only store. The remaining public search/status/forget lifecycle activation belongs to the next stage. No agent schema files or dependencies change.Evidence
No local Docker was used. The test cluster and all data were task-owned and synthetic.
The requested independent review found one P2 trigram-ranking defect. It is fixed with native word-similarity ranking and a competing-candidate regression; the public refusal and SQLite paths remain unchanged. The simplification pass retained one query adapter, without a new persistence owner or compatibility layer.
Local static gates pass: core and memory-package typechecks, targeted production/test/tooling lint, formatting, diff whitespace, database worker inventory (222 → 222 main-thread calls), and database dialect ratchet (no growth). The worker-only PG query adapter is recorded in the existing inventory with its sole runtime caller.
Change size: 985 insertions, 25 deletions, net +960 across 12 files (including 566 new test lines). No agent schema files are touched.
The first CI architecture pass found a type-only cycle between the PostgreSQL helper and worker. Shared query types now live in a leaf module and all consumers import them there; the failed Madge check rerun reports zero cycles, and the package typecheck and targeted lint pass. Query SQL and runtime behavior are unchanged by this correction.
Final-head CI
At
fc1398c29f777db4f8e52ab7f96200bc0ce77d26, PostgreSQL conformance passed in 16m29s. The architecture guard, build, typechecks, lint, database ratchets, and changed-extension tests also passed.The only failed test job is Control UI E2E shard 5/7:
Control UI mobile widget scrolling > keeps touch flings continuous through widgets and preserves the reader during streamingmeasured 115px at release against a >120px assertion. The failed aggregateopenclaw/ci-gateis downstream of that single job; there are no cancelled jobs.Landing uses the operator-authorized native admin exception for this unrelated flake. None of the 12 changed paths are UI or browser-harness files. The failing test installs a mocked Gateway and exercises touch scrolling, widget rendering, and streaming; its execution path is disjoint from the PostgreSQL memory search changes. The public PostgreSQL memory-search refusal remains in place.
Main comparison: scheduled main run 38908699969, at
086990922132bbc68bdc6503b95c81598a655f6b, reports every UI E2E shard successful. The preceding completed main run 38902471699 also passed every UI shard. There is no matching failure on those main runs; this exception relies on the expressly authorized disjoint causal path, not a matching-signature claim. One isolated exact-head macOS replay previously passed. The original Linux failure remains unreproduced, with no threshold edits or CI retries.