Repository navigation
feat(memory): memory forget, status and search on PostgreSQL - #174374
Conversation
Serve public text, vector, and hybrid retrieval through the admitted PostgreSQL memory projections. Complete forget, status, and derived reset while preserving SQLite SQL and explicit keyword-only mode. Correct PostgreSQL single-session transcript statistics and remove the redundant SQLite extension requirement in the public forget coordinator. Keep missing vector support actionable.
|
🦞👀 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cf9885114
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async function hasBuiltInMemoryState(databasePath: string, agentId: string): Promise<boolean> { | ||
| if (!existsSync(databasePath)) { | ||
| return false; |
There was a problem hiding this comment.
Probe PostgreSQL before checking the SQLite path
When the agent database uses PostgreSQL and memory search has no explicit override, the configured databasePath is only the local SQLite/anchor path and may not exist even though the PostgreSQL memory index does. This early return therefore prevents the newly added PostgreSQL presence worker from running, causing resolveSharedMemoryStatusSnapshot to return null and silently omit memory from openclaw status; bypass the filesystem check for PostgreSQL or let the engine-aware probe determine presence.
AGENTS.md reference: AGENTS.md:L81-L81
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. What this changesThis PR enables PostgreSQL memory search, forgetting, status, and derived-index reset through the existing memory workers. Example: An agent using PostgreSQL indexes memory/sapphire.md containing northern harbor coordinates.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR completes useful PostgreSQL memory lifecycle support that current main deliberately leaves disabled; no actionable introduced defect was established. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherMemory Core turns agent memory files and permitted transcripts into searchable projections; its existing workers handle retrieval, publication, forgetting, and status against the selected agent database engine. flowchart LR
Sources[Memory files and transcripts] --> Manager[Memory Core manager]
Manager --> Workers[Existing memory workers]
Workers --> Owner[Agent database owner]
Owner --> SQLite[SQLite index]
Owner --> PostgreSQL[PostgreSQL projections]
Workers --> Results[Search results and lifecycle status]
Technical reviewBest possible solution: Complete PostgreSQL activation through the existing memory owners while preserving SQLite behavior and the documented experimental ranking contract. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the deliberate PostgreSQL memory refusal; this PR enables a capability rather than repairing a reproduced regression. Is this the best way to solve the issue? The implementation follows the existing retrieval, publication, and forget owners, removes obsolete activation machinery, and preserves the established SQLite branches. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b646675ff84c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +260, Tests +538, Docs +46, Other +1. Total +845 across 39 files. Added test files: 2. View PR surface stats
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 October 16, 2026, 11:54 AM ET / 15:54 UTC. |
|
Merged via squash.
|
* commit '14e993fff3ecb84eb1d7c9724c4ceda235d797e4': (110 commits) fix(decisions): align accounting ratchet evidence feat(memory): activate PostgreSQL memory search and lifecycle (#174374) fix: join process shutdown and isolate runtime fixtures (#174359) refactor(ui): scope native gateway observation to Solid (#174367) refactor(ui): own canvas widget lifetime in Solid (#174370) perf(control-ui): keep agent avatar faces stable across agent publications (#174239) perf(models): release unused account catalog instructions (#174361) refactor(ui): own composer command menus in Solid stores (#174321) refactor(ui): separate sidebar filter state from view lifecycle (#174352) test(release): make artifact qualification deadlines deterministic fix(codex): preserve sandboxed process inspection and setup errors (#174284) fix(gateway): stop worker processes before draining their queues (#174312) refactor(agents): reuse prepared tool facts (#174349) test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331) refactor(ui): replace MCP retirement host adapters with a factory (#174375) refactor(logging): remove redundant native success traces (#174330) refactor(test): remove dead control-plane fixture branches (#174377) refactor(mcp): remove test-only session runtime seams (#174347) feat(matrix): account-root state databases follow the selected engine (#174315) refactor(discord): collapse private interaction and factory seams (#174322) ...
* commit '14e993fff3ecb84eb1d7c9724c4ceda235d797e4': (110 commits) fix(decisions): align accounting ratchet evidence feat(memory): activate PostgreSQL memory search and lifecycle (#174374) fix: join process shutdown and isolate runtime fixtures (#174359) refactor(ui): scope native gateway observation to Solid (#174367) refactor(ui): own canvas widget lifetime in Solid (#174370) perf(control-ui): keep agent avatar faces stable across agent publications (#174239) perf(models): release unused account catalog instructions (#174361) refactor(ui): own composer command menus in Solid stores (#174321) refactor(ui): separate sidebar filter state from view lifecycle (#174352) test(release): make artifact qualification deadlines deterministic fix(codex): preserve sandboxed process inspection and setup errors (#174284) fix(gateway): stop worker processes before draining their queues (#174312) refactor(agents): reuse prepared tool facts (#174349) test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331) refactor(ui): replace MCP retirement host adapters with a factory (#174375) refactor(logging): remove redundant native success traces (#174330) refactor(test): remove dead control-plane fixture branches (#174377) refactor(mcp): remove test-only session runtime seams (#174347) feat(matrix): account-root state databases follow the selected engine (#174315) refactor(discord): collapse private interaction and factory seams (#174322) ...
* commit '0c6c7ee5837ed93f6fb09ca58b280e76878c21f1': (109 commits) feat(memory): activate PostgreSQL memory search and lifecycle (#174374) fix: join process shutdown and isolate runtime fixtures (#174359) refactor(ui): scope native gateway observation to Solid (#174367) refactor(ui): own canvas widget lifetime in Solid (#174370) perf(control-ui): keep agent avatar faces stable across agent publications (#174239) perf(models): release unused account catalog instructions (#174361) refactor(ui): own composer command menus in Solid stores (#174321) refactor(ui): separate sidebar filter state from view lifecycle (#174352) test(release): make artifact qualification deadlines deterministic fix(codex): preserve sandboxed process inspection and setup errors (#174284) fix(gateway): stop worker processes before draining their queues (#174312) refactor(agents): reuse prepared tool facts (#174349) test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331) refactor(ui): replace MCP retirement host adapters with a factory (#174375) refactor(logging): remove redundant native success traces (#174330) refactor(test): remove dead control-plane fixture branches (#174377) refactor(mcp): remove test-only session runtime seams (#174347) feat(matrix): account-root state databases follow the selected engine (#174315) refactor(discord): collapse private interaction and factory seams (#174322) refactor(feishu): reuse streaming merge in dispatcher tests (#174371) ...
* commit '14e993fff3ecb84eb1d7c9724c4ceda235d797e4': (110 commits) fix(decisions): align accounting ratchet evidence feat(memory): activate PostgreSQL memory search and lifecycle (#174374) fix: join process shutdown and isolate runtime fixtures (#174359) refactor(ui): scope native gateway observation to Solid (#174367) refactor(ui): own canvas widget lifetime in Solid (#174370) perf(control-ui): keep agent avatar faces stable across agent publications (#174239) perf(models): release unused account catalog instructions (#174361) refactor(ui): own composer command menus in Solid stores (#174321) refactor(ui): separate sidebar filter state from view lifecycle (#174352) test(release): make artifact qualification deadlines deterministic fix(codex): preserve sandboxed process inspection and setup errors (#174284) fix(gateway): stop worker processes before draining their queues (#174312) refactor(agents): reuse prepared tool facts (#174349) test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331) refactor(ui): replace MCP retirement host adapters with a factory (#174375) refactor(logging): remove redundant native success traces (#174330) refactor(test): remove dead control-plane fixture branches (#174377) refactor(mcp): remove test-only session runtime seams (#174347) feat(matrix): account-root state databases follow the selected engine (#174315) refactor(discord): collapse private interaction and factory seams (#174322) ...
* commit '0c6c7ee5837ed93f6fb09ca58b280e76878c21f1': (109 commits) feat(memory): activate PostgreSQL memory search and lifecycle (#174374) fix: join process shutdown and isolate runtime fixtures (#174359) refactor(ui): scope native gateway observation to Solid (#174367) refactor(ui): own canvas widget lifetime in Solid (#174370) perf(control-ui): keep agent avatar faces stable across agent publications (#174239) perf(models): release unused account catalog instructions (#174361) refactor(ui): own composer command menus in Solid stores (#174321) refactor(ui): separate sidebar filter state from view lifecycle (#174352) test(release): make artifact qualification deadlines deterministic fix(codex): preserve sandboxed process inspection and setup errors (#174284) fix(gateway): stop worker processes before draining their queues (#174312) refactor(agents): reuse prepared tool facts (#174349) test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331) refactor(ui): replace MCP retirement host adapters with a factory (#174375) refactor(logging): remove redundant native success traces (#174330) refactor(test): remove dead control-plane fixture branches (#174377) refactor(mcp): remove test-only session runtime seams (#174347) feat(matrix): account-root state databases follow the selected engine (#174315) refactor(discord): collapse private interaction and factory seams (#174322) refactor(feishu): reuse streaming merge in dispatcher tests (#174371) ...
Keep Discord processing at its live owner while replacing namespace spies with the named module spy and deleting the preflight re-export used only by tests. Preserve every assertion and exercise all importers of the changed helper. Expose existing memory CLI registration through the public runtime barrel for the PostgreSQL core test, retaining the plugin boundary. Add shipped cli-parent-lifetime.mjs to both focused guard commands. Causes: d49ea0f (#174322), 8955750 (#174374), and 75d827b (#174268). No runtime policy or timeout changes. Proof: 165 focused tests passed with --maxWorkers=1 (444.35s), 12 plugin boundary tests passed (19.14s) after the old-import negative control, core/extension/test types, source contracts, focused guard, and P2 review. Remaining independent audit finding: ORIGINAL_REVISION in an unchanged Gateway fixture. Standalone package types report unchanged memory-core connection/tableHasColumn errors; canonical source/type lanes pass.
…aw#174374) Serve public text, vector, and hybrid retrieval through the admitted PostgreSQL memory projections. Complete forget, status, and derived reset while preserving SQLite SQL and explicit keyword-only mode. Correct PostgreSQL single-session transcript statistics and remove the redundant SQLite extension requirement in the public forget coordinator. Keep missing vector support actionable.
…74482) Keep Discord processing at its live owner while replacing namespace spies with the named module spy and deleting the preflight re-export used only by tests. Preserve every assertion and exercise all importers of the changed helper. Expose existing memory CLI registration through the public runtime barrel for the PostgreSQL core test, retaining the plugin boundary. Add shipped cli-parent-lifetime.mjs to both focused guard commands. Causes: b5c5a99 (openclaw#174322), 9409878 (openclaw#174374), and 963fbbd (openclaw#174268). No runtime policy or timeout changes. Proof: 165 focused tests passed with --maxWorkers=1 (444.35s), 12 plugin boundary tests passed (19.14s) after the old-import negative control, core/extension/test types, source contracts, focused guard, and P2 review. Remaining independent audit finding: ORIGINAL_REVISION in an unchanged Gateway fixture. Standalone package types report unchanged memory-core connection/tableHasColumn errors; canonical source/type lanes pass.
What Problem This Solves
PostgreSQL agent databases still refuse public memory search even though their indexing and search adapters exist. Forgetting, status, and index reset also need to use the selected engine.
User Impact
Memory indexing, text/vector/hybrid retrieval, forgetting, status, and derived-index reset work on PostgreSQL. Search remains experimental: text scores and ordering are engine-local. Explicit
memory.search.provider: "none"supports keyword-only databases without pgvector; semantic requests retain the named capability error and extension-installation guidance.Why This Change Was Made
The public memory manager now uses admitted PostgreSQL search projections through its existing workers. Forget removes source rows and their text/vector projections in one owner transaction; reset reuses the publication owner and preserves schema, sessions, and memory files. Status consumes admitted facts. The old public refusal and test-only activation path are removed; standing intents retain their separate refusal.
Public-flow proof exposed two remaining SQLite assumptions: single-session transcript statistics lacked PostgreSQL's required grouping, and forget required a native extension path for every vector table. The PostgreSQL point query now groups by session ID without changing SQLite's statement, and forget consumes the worker's prepared facts directly.
Builds on #174085, #174183, and #174242.
The existing worker, publication, and forget owners carry the new behavior; no new schema or lifecycle owner is introduced. The obsolete refusal module, test-only activation argument, and refusal-only test are removed. Diff: production/scripts +438/−177; tests +625/−87; docs +159/−113 (39 files, net +845 lines).
Evidence
Earlier local-base findings (current-head CI is green): max-lines suppression findings in
ui/src/pages/chat/components/chat-message.test.tsx,ui/src/pages/config/config-page-state.ts, andui/src/pages/sessions/sessions-page-state.ts; wrapper shadowing forapplyProviderAuthConfigPatchbetweensrc/plugins/provider-auth-choice-helpers.tsandsrc/plugin-sdk/provider-auth.ts. These files are unchanged.A documentation conflict with current main was resolved by preserving its newly landed agent port/backup support alongside memory activation. Post-integration proof reran all 15 PostgreSQL public/adapter cases successfully; the generated worker inventory and 15,601 documentation links are current. Earlier unchanged-input SQLite capture and full memory-core proof remain applicable.
Exact-head CI for
3cf98851143ad516a7e0b7a12301b8fa29e054e4is green: CI run 38925681392 completed successfully, PostgreSQL conformance passed, and the aggregate gate passed. Final check list: 87 passed, 59 skipped, zero failed or pending. The watcher excluded superseded attempts; no CI jobs were manually rerun. The PR remains ready and unmerged.