Repository navigation
feat(memory): add a provider-neutral memory provider runtime - #162175
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: blocked before merge. Reviewed October 2, 2026, 4:23 PM ET / 20:23 UTC (Revision 12). ClawSweeper reviewWhat this changesAdds a caller-bound memory provider interface so record-based plugins can serve recall, voice context, Memory Wiki, and Gateway reads while preserving legacy file-backed readers. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main lacks this provider-neutral memory capability, and this maintainer-authored PR remains useful. No blocking correctness finding was established; the previous migration-proof request does not apply because this patch changes no persisted-data contract. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s memory runtime connects the selected memory plugin to agent recall and operator searches. It translates caller authority and retrieval requests into provider results that feed prompts, voice context, and memory diagnostics. flowchart TD
A[Agent recall and voice requests] --> C[Selected memory runtime]
B[Authorized Gateway requests] --> C
C --> D{Native provider available}
D --> E[Caller-bound provider lease]
D --> F[Legacy memory reader]
E --> G[Authorized memory results]
F --> G
G --> H[Prompts and operator responses]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1887, Tests +2517, Docs +143, Config 0. Total +4547 across 62 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one selected memory owner behind the additive caller-bound contract, with legacy readers preserved and provider-owned visibility enforced before data is released. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature reproduction: current-main source confirms memory consumers still depend on the legacy file-shaped runtime. Is this the best way to solve the issue? Yes: extending the existing selected-slot owner with a neutral read contract addresses the missing capability while retaining established legacy readers and cleanup ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b4d1a0efc8a9. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
7eea7b5 to
d6608bb
Compare
d6608bb to
3e6aa3b
Compare
Memory consumers were bound to the file-backed search manager, so a memory plugin whose records are not workspace files could not serve recall. Add a caller-bound MemoryProviderRuntime (search, get, health, optional candidates and refresh) registered as MemoryPluginCapability .providerRuntime. Providers declare their capabilities (sources, pagination, candidate kinds, project filtering); the host validates them at open and the bound handle rejects undeclared requests before calling the provider. Project recall, realtime voice context, Active Memory trigger recall, and Memory Wiki use the neutral runtime when the selected slot owner registers providerRuntime. With a legacy runtime they keep their manager calls, purposes, authorization, results, and citation labels unchanged. Deciding which path to take reads only owners this process already loaded (the current registry, the process registry, or a standalone owner), never loading the slot plugin to decide. Add the Gateway memory.search v2 / memory.get / memory.status RPCs. A legacy adapter serves them over existing file-backed managers, preserving session-hit authorization: session callers keep requester visibility plus any host-granted conversation recall pass carried on their session authority, and sessionless host or operator callers keep the opened agent's own session hits through Memory Core's trusted agent scope. Its health omits host paths. Any authenticated operator connection with operator.read can call them, as with unversioned memory.search; in-process agent callers keep their run's operator authority. memory.search v2 rejects missing, unknown, or empty source restrictions before provider admission. Unversioned or version 1 memory.search directs a provider-runtime owner's clients to retry with version 2. Realtime voice fast context binds its provider reads to the live call and consult abort signal. Plugins released before that liveness argument keep their call shape: without it, legacy owners answer as before and a native provider is never read. When another plugin owns the memory slot, Memory Core's CLI reports that provider's health from memory status, refuses memory search, and labels index commands as acting on its sidecar index. The memory-host-search SDK subpath stays private-local, so the public SDK surface does not grow. Memory Wiki's package boundary maps memory-core's session visibility leaf to its declaration producer.
27ea94b to
97217ad
Compare
* commit '79be075e5aa46be9e42dbd53ed6e30e81469210a': (33 commits) fix(ui): keep selected-text comment input readable while scrolling (#163772) test(memory): open corpus database explicitly fix: bound Doctor migration capture to plugin data (#163780) fix(ui): gate system information at the shared reader (#160982) chore(db): reclassify worker inventory sites with caller evidence (#163754) refactor(channels): deslop Slack and Matrix (#163740) fix(agents): reject empty sessions_search queries in the tool schema (#129120) perf(nodes): load only what a worker turn needs (#160442) test(cli): assert concise Gateway failure copy in CLI process tests (#163649) refactor(discord): deslop discord (#163728) fix(workboard): make Sessions boards work on multi-agent Gateways (#163761) test(gateway): add sustained heap retention diagnostics (#163764) test(ui): disambiguate session filter controls refactor(plugins): deslop imessage, mattermost, and voice-call (#163767) fix(qa): run Telegram plugin source in --source-gateway userbot runs (#163718) feat(macos): add a --no-activate launch flag for background automation (#163758) fix(agents): preserve host authority across module reloads (#163725) perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (#163690) fix: keep video widgets scrollable and preload initial frames (#163762) feat(memory): add a provider-neutral memory provider runtime (#162175) ...
…w#162175) Memory consumers were bound to the file-backed search manager, so a memory plugin whose records are not workspace files could not serve recall. Add a caller-bound MemoryProviderRuntime (search, get, health, optional candidates and refresh) registered as MemoryPluginCapability .providerRuntime. Providers declare their capabilities (sources, pagination, candidate kinds, project filtering); the host validates them at open and the bound handle rejects undeclared requests before calling the provider. Project recall, realtime voice context, Active Memory trigger recall, and Memory Wiki use the neutral runtime when the selected slot owner registers providerRuntime. With a legacy runtime they keep their manager calls, purposes, authorization, results, and citation labels unchanged. Deciding which path to take reads only owners this process already loaded (the current registry, the process registry, or a standalone owner), never loading the slot plugin to decide. Add the Gateway memory.search v2 / memory.get / memory.status RPCs. A legacy adapter serves them over existing file-backed managers, preserving session-hit authorization: session callers keep requester visibility plus any host-granted conversation recall pass carried on their session authority, and sessionless host or operator callers keep the opened agent's own session hits through Memory Core's trusted agent scope. Its health omits host paths. Any authenticated operator connection with operator.read can call them, as with unversioned memory.search; in-process agent callers keep their run's operator authority. memory.search v2 rejects missing, unknown, or empty source restrictions before provider admission. Unversioned or version 1 memory.search directs a provider-runtime owner's clients to retry with version 2. Realtime voice fast context binds its provider reads to the live call and consult abort signal. Plugins released before that liveness argument keep their call shape: without it, legacy owners answer as before and a native provider is never read. When another plugin owns the memory slot, Memory Core's CLI reports that provider's health from memory status, refuses memory search, and labels index commands as acting on its sidecar index. The memory-host-search SDK subpath stays private-local, so the public SDK surface does not grow. Memory Wiki's package boundary maps memory-core's session visibility leaf to its declaration producer.
* commit '1fda703fb4d3630e4633461967b2a2186e8f15fd': (33 commits) fix(ui): keep selected-text comment input readable while scrolling (openclaw#163772) test(memory): open corpus database explicitly fix: bound Doctor migration capture to plugin data (openclaw#163780) fix(ui): gate system information at the shared reader (openclaw#160982) chore(db): reclassify worker inventory sites with caller evidence (openclaw#163754) refactor(channels): deslop Slack and Matrix (openclaw#163740) fix(agents): reject empty sessions_search queries in the tool schema (openclaw#129120) perf(nodes): load only what a worker turn needs (openclaw#160442) test(cli): assert concise Gateway failure copy in CLI process tests (openclaw#163649) refactor(discord): deslop discord (openclaw#163728) fix(workboard): make Sessions boards work on multi-agent Gateways (openclaw#163761) test(gateway): add sustained heap retention diagnostics (openclaw#163764) test(ui): disambiguate session filter controls refactor(plugins): deslop imessage, mattermost, and voice-call (openclaw#163767) fix(qa): run Telegram plugin source in --source-gateway userbot runs (openclaw#163718) feat(macos): add a --no-activate launch flag for background automation (openclaw#163758) fix(agents): preserve host authority across module reloads (openclaw#163725) perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (openclaw#163690) fix: keep video widgets scrollable and preload initial frames (openclaw#163762) feat(memory): add a provider-neutral memory provider runtime (openclaw#162175) ...
What Problem This Solves
Memory consumers can only read a file-backed search manager, so a memory plugin whose records are not workspace files cannot serve recall.
User Impact
Existing installs are unchanged. When Memory Core or any
runtime-only (V1) memory plugin owns the slot, every consumer runs main's code path, producing the same results, prompt bytes, citation labels, plugin calls and loading order. That covers Active Memory, project recall, Memory Wiki, voice fast context, Doctor, status, compaction and Gatewaymemory.searchv1. A differential pass checked this against main on isolated Gateways, under four configurations: Memory Core, Memory Core with Wiki, and a V1 plugin with and withoutauthorizeSearchHits.New for plugin authors: a memory plugin can register a caller-bound
providerRuntimewith declared capabilities. A provider that does gets:memory.searchv2,memory.getandmemory.status, open to the sameoperator.readcallers as v1memory.searchthat answersINVALID_REQUEST … retry memory.search with version: 2instead of searching a file index the provider doesn't useopenclaw memory statusreporting that provider's health, with Memory Core noted as the consolidation sidecar onlyIntended differences, by design:
memory.searchvalidatesversion, so a string"1"is rejected.memory.getandmemory.statusmethods;memory.statusomits filesystem paths, matchingstatusredaction for non-admin callers.No persisted data changes: no tables, columns, stored formats or migrations.
Why This Change Was Made
The host owns one contract,
MemoryPluginCapability.providerRuntime. The host validates declared capabilities at open, and the bound handle rejects undeclared requests before they reach the provider. The new provider path runs only when a native provider owns the slot (isActiveMemoryProviderNative); legacy owners keep main's code.memory-host-searchstays private-local, so public SDK budgets are unchanged.Compatibility fixes in this revision:
liveness. That still works: legacy owners answer as before, and a native provider is never read without live-call authority.session-search-visibility-apileaf is restored, so the extension package-boundary check selects memory-core again. The same check fails on main sinceef97e9a0429.This is the first of a three-PR stack: #162176 (host-resolved memory audience) and #162177 (provider-owned pre-compaction flush) follow.
Evidence
openclaw gateway call, with a provider-runtime plugin in the slot: the unversioned call returns the v2 redirect, and v2 search, get and status succeed for a tokenoperator.readclient.handleGatewayRequestsources: []rejection, project-recall cleanup containment, and the method-list suffixtsgolanes,check:architecture,protocol:check, plugin-sdk surface/exports,docs:check-mdxand focused vitest: passcheck-changed: lint fails only on inheritedmax-lineserrors, in files this PR doesn't touch, with identical counts on main (agent-create.integration.test.ts,git-backup.test.ts,openclaw-agent-db.ts,openclaw-state-read.worker.ts,run-attempt-dispatch.ts,subagent-spawn.ts)Inherited CI failures
CI on
7baaf4bd036fails 5 shards. None is caused by this PR: each failing test either fails today on unrelated PRs or passes in isolation on this PR's commit and on main, and this PR touches none of their files.compact-large-25-1packages/memory-host-sdk/src/host/session-transcript-corpus.test.ts(getOpenClawAgentDatabaseIfOpen(...)undefined)fix/session-anchor-dedup. Passes in isolation on this PR and on main (11/11).compact-large-8src/agents/subagents/spawn/subagent-spawn.production-boundary.test.ts("Subagent browser cleanup lost its original owner")fix/session-anchor-dedupanddeslop/l201-infra7. Passes in isolation on this PR and on main (8/8).extensions-bundle-30-2extensions/tlon/src/monitor/index.test.tsdeslop/l201-infra7.extensions-bundle-26extensions/whatsapp/src/auto-reply.web-auto-reply.media-delivery.test.tsfeat/whatsapp-poll-vote-hook.extensions-bundle-15-3extensions/browser/src/browser/server-context.list-profiles.test.tsextensions/browser/.The common thread is agent-database lifecycle within a shard ("Agent database resources are closing", or the database handle missing), which looks like cross-test interference currently on main. In the previous CI round,
status.summary-read-onlyfailed the same way and also fails ondeslop/l201-infra7andrefactor/lg-runtime-claws-canonical. The earlier error-message failures (cli-json-stdout.*,entry.memory-json,models-dispatch.catalog, QA-lab wire tests) came from main's #163381 and were fixed by rebasing onto main's #163525 / #163538.