Repository navigation
feat(memory): let the memory slot own the pre-compaction flush - #162177
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, 10:45 PM ET / October 3, 2026, 02:45 UTC (Revision 13). ClawSweeper reviewWhat this changesThe selected memory plugin can save context before compaction through its own tools, with optional lookup tools and the source conversation’s memory permissions. Merge readiness⛔ Blocked before merge - 1 item remains This PR still provides a distinct capability absent from current main. The earlier resolver compatibility finding is resolved, and the previous migration-proof blocker is unsupported by the introduced changes. No blocking correctness finding remains. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw runs a quiet memory-saving turn before conversation compaction. This change lets the selected memory plugin receive that conversation context and save it through its own storage tools while the host controls timing, tool policy, and session authority. flowchart TD
A[Conversation context] --> B[Host flush timing]
B --> C[Selected memory plugin plan]
C --> D{Persistence method}
D --> E[Restricted workspace writer]
D --> F[Plugin tools with delegated audience]
E --> G[Completion or recorded failure]
F --> G
G --> H[Conversation compaction]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +629, Tests +1091, Docs +120. Total +1840 across 38 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep host-owned flush admission and authority checks while letting the selected plugin persist through its declared tools, preserving the released file-plan API. Do we have a high-confidence way to reproduce the issue? Not applicable as an existing-behavior bug: current main’s file-only flush contract establishes the missing capability, and supplied Gateway traces exercise the new path. Is this the best way to solve the issue? Yes. Extending the selected memory plugin’s contract is a focused way to support non-file storage, and the separate optional resolver preserves released consumers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5c894c71b889. 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 (12 earlier review cycles; latest 8 shown)
|
35223a2 to
8fdbaf8
Compare
1e94828 to
579d7df
Compare
579d7df to
a58687c
Compare
8fdbaf8 to
c60fb8b
Compare
a58687c to
2538b39
Compare
c60fb8b to
4ff568e
Compare
2538b39 to
d26746c
Compare
7b4279c to
16d7e99
Compare
d26746c to
b539626
Compare
|
Maintainer decision (SDK/security owner): accepted. The memory slot owner may persist the pre-compaction flush through its own tools. The host delegates the source turn's memory audience to the detached flush session, bound to that session's incarnation, with a stable One condition: existing |
A memory plugin that does not store workspace files could not persist the pre-compaction memory flush. A flush plan resolver may return a MemoryFlushToolsPlan beside the file plan: the memory slot owner may name persistence tools and read-only lookup tools it owns. A tools-arm flush exposes read plus those tools after normal tool policy, runs with the source turn's memory audience delegated to the detached flush session (when a native provider owns the slot) and a flushId derived from the source session incarnation that stays stable across fallback and retry, and succeeds only after a non-error persistence call or NO_REPLY. Post-turn maintenance copies keep senderIsOwner false but carry the source turn's trusted owner status for the flush audience. Sidecar resolvers cannot return a tools arm, and plans whose lookup and persistence tools overlap are skipped with a warning. Only a native provider's flush runs for a session that cannot write its workspace; other resolvers are not called for such sessions. Flush timing (enabled, soft threshold, forced transcript size, reserve floor, context-window cap) is now resolved once in the host. The released MemoryFlushPlan keeps its shape; a resolver may instead return a MemoryFlushFilePlanDraft whose omitted timing fields the host fills, and defined timing fields are deliberate overrides. The configured flush model fills a tools-arm plan's omitted model; a file plan names its own model, so a legacy plan without one keeps the session's model. Memory Core's resolver returns its prompts, dated path, and configured model.
Restore flushPlanResolver to its released MemoryFlushPlan | null return so null-checked consumers keep compiling, and add providerFlushPlanResolver for host-completed file drafts and tool persistence plans. The host binds the winning resolver to its supplier as one unit across sidecar merges, so a sidecar's resolver is never credited to the slot owner. Memory Core keeps its released resolver unchanged.
33e6eb5 to
2892d23
Compare
…law#162177) * feat(memory): let the memory slot own the pre-compaction flush A memory plugin that does not store workspace files could not persist the pre-compaction memory flush. A flush plan resolver may return a MemoryFlushToolsPlan beside the file plan: the memory slot owner may name persistence tools and read-only lookup tools it owns. A tools-arm flush exposes read plus those tools after normal tool policy, runs with the source turn's memory audience delegated to the detached flush session (when a native provider owns the slot) and a flushId derived from the source session incarnation that stays stable across fallback and retry, and succeeds only after a non-error persistence call or NO_REPLY. Post-turn maintenance copies keep senderIsOwner false but carry the source turn's trusted owner status for the flush audience. Sidecar resolvers cannot return a tools arm, and plans whose lookup and persistence tools overlap are skipped with a warning. Only a native provider's flush runs for a session that cannot write its workspace; other resolvers are not called for such sessions. Flush timing (enabled, soft threshold, forced transcript size, reserve floor, context-window cap) is now resolved once in the host. The released MemoryFlushPlan keeps its shape; a resolver may instead return a MemoryFlushFilePlanDraft whose omitted timing fields the host fills, and defined timing fields are deliberate overrides. The configured flush model fills a tools-arm plan's omitted model; a file plan names its own model, so a legacy plan without one keeps the session's model. Memory Core's resolver returns its prompts, dated path, and configured model. * fix(memory): keep the released flush plan resolver contract Restore flushPlanResolver to its released MemoryFlushPlan | null return so null-checked consumers keep compiling, and add providerFlushPlanResolver for host-completed file drafts and tool persistence plans. The host binds the winning resolver to its supplier as one unit across sidecar merges, so a sidecar's resolver is never credited to the slot owner. Memory Core keeps its released resolver unchanged.
…ply text (wave-4 bundle) (#172669) * refactor(infra): remove redundant replay and freshness machinery Trust successful migration statements inside their synchronous transactions, reuse unchanged approval parses, share canonical package-root discovery, namespace directory caches by plugin identity, and simplify ephemeral presence, OS facts and suspension timer bookkeeping. Keep source validation, conflicts, transaction durability, postcommit checks, security authority and write settlement. Best-effort tradeoffs accepted - Node-host own-write verification (#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain. - Workspace setup/attestation replay (#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks. - APNs expected-ID replay (#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain. - Device-auth presence assertion (#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain. - Device-identity replay (#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion. - MCP OAuth replay (#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain. - Exec-approval read/parse/deep-compare replay (#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged. - Shared-auth target reread (#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks. - Identical authored approval bytes (#168094) reuse the existing parse; changed normalized bytes still parse before publication. - Plugin metadata fingerprinting (353d778): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset. - Duplicate asset ancestor search (7224585): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart. - Presence logical clock (#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain. - Suspension timer generation (#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early. - OS tuple-keyed cache (#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace. - Presence list type guards (409a160): callers supply validated arrays; existing normalization still owns their values. Production +40/-228, net -188. Focused migration, asset/cache, presence/caller, approval-publication and suspension/OS tests pass, as do production and infra-test types, changed-file lint, assertion and suppression checks, and zero-cycle checks. Independent final review has no actionable P0-P2 findings. No schema, durability, retention, indexing, permission, recovery or public SDK change is intended. Broad changed-check is not claimed green: the original base reproduces the 455-versus-454 environment budget failure. The initial Web Push Doctor timeout remains unattributed; all Web Push production hunks were dropped and its exact test passed on restored source. Full build and hosted CI remain unrun. * refactor(agents): simplify reply preparation and refresh bookkeeping Share typed actor-store adapters and prepared async auth reads. Reuse the admitted memory-flush plan, retain last-good catalog views by provider, and remove unused metadata bookkeeping and config projections. Preserve live credential/effect authority, FIFO, transcript durability, and ordinary write settlement. Net production reduction: 303 lines. Best-effort tradeoffs accepted: - Plugin-drain successors (#162301, synthetic): wait the current drain once; a later reload owns its own publication and recovery. - A changed memory-flush plan during preparation (#162177/#121157, synthetic): finish with the admitted plan; the next turn resolves again. - Per-row catalog freshness (#158113, synthetic): failed discovery retains the provider's last-good configured and supplemental overlays until success. Existing auth/profile/source gates and successful-empty replacement remain. - MCP sibling invalidation during discovery (#138694, synthetic): a listing may briefly be stale; the next read observes the invalidation. - Passive context metadata supersession (#119607, synthetic): late discovered metadata may win until refresh. Keep the single current-promise check before replacing configured limits, preserving the human capacity fix (#39857). - Registration-time question answers (#110372/#134003, synthetic): a prompt can briefly race the answer; its terminal signal closes delivery. - Duplicate or never-attached internal question registrations: both real producers attach once synchronously. Unsupported misuse loses its extra diagnostic/disposal wakeup; ordinary lifecycle rejection remains. - Cancellation publication once/must-consume flags (#161124, synthetic): the sole internal producer invokes once. Keep active-scope/effect authority. - In-flight placement-service replacement (#164744, synthetic): use the captured startup service, with its observation and writer authority intact. - Compaction callback rebinding (#146732/#163264, synthetic): current work retains its captured callbacks and live assertion; later work captures anew. - Re-entrant logging between synchronous run-owner checks: #162227 removed the awaited retry, making the second check redundant. Real post-await and mutation-effect checks remain. - Startup diagnostic admission (#146792): the sole producer checks lifecycle immediately before recording. Remove only the recorder's duplicate check; preserve the human abort/recovery fix (#146692), reset, and admin redaction. Release-note context: verbose diagnostics no longer include suppressed reply text or background bash command contents. Execution and user replies remain unchanged. Config show uses the same schema-aware redactor without cloning an already detached result or redacting unused snapshot views. Validation: touched core, messaging and Gateway-method type graphs passed; 49 changed TypeScript files passed targeted lint/format; runtime and Madge cycles are both zero. Auth reader, question authority, memory flush, restart claim, catalog worker, cancellation and compaction boundary proof is recorded in the lane ledger. Final supplemental run: 392 tests passed, four failed across 28 files, with final source verification. All 120 agents-support tests passed, including refresh coalescing, publication, run-wait and compaction. The four failures were an unchanged 120s ACP reset deadline and three MCP fixtures settling before child startup markers (empty logs, existing 1-2s connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset and two MCP cases; the one-second MCP retirement fixture still failed before its first child marker. Clean lane-base comparison could not reach assertions: the temporary checkout lacked workspace-local dependency links for worker compilation. That case is unresolved, not proven inherited; coordinator-bundle CI must adjudicate it. No deadline, retry, skip or assertion was weakened. The final selected real-dispatch suppressed-reply logging regression passed with completed source verification (one selected case, 202.58s wrapper). Independent P0-P2 review completed four passes. Declined duplicate findings about unsupported placement-service hot-swap (real observation/database/writer authority remains) and alleged run-wait awaits (only synchronous logging lies between the checks; real mutation and post-await checks remain). Broad check-changed is NOT green: env-name budget 455/454 also fails on the unchanged lane-base index, with no added env names; production/full-tree Knip hit their existing 600s budget; the silent legacy-store scan was interrupted after 782s. Those two scans are missing proof, not attributed inherited reds. Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy fixture findings were corrected and their targeted replays pass. No changelog, dependency, database schema, durability, retention, permission, or public API change is included. BELOW-500 branch-only coordinator handoff; no lane PR or merge. * chore: shrink stale reply assertion allowance * test: align catalog publication calls with current contract
…ply text (wave-4 bundle) (openclaw#172669) * refactor(infra): remove redundant replay and freshness machinery Trust successful migration statements inside their synchronous transactions, reuse unchanged approval parses, share canonical package-root discovery, namespace directory caches by plugin identity, and simplify ephemeral presence, OS facts and suspension timer bookkeeping. Keep source validation, conflicts, transaction durability, postcommit checks, security authority and write settlement. Best-effort tradeoffs accepted - Node-host own-write verification (openclaw#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain. - Workspace setup/attestation replay (openclaw#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks. - APNs expected-ID replay (openclaw#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain. - Device-auth presence assertion (openclaw#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain. - Device-identity replay (openclaw#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion. - MCP OAuth replay (openclaw#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain. - Exec-approval read/parse/deep-compare replay (openclaw#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged. - Shared-auth target reread (openclaw#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks. - Identical authored approval bytes (openclaw#168094) reuse the existing parse; changed normalized bytes still parse before publication. - Plugin metadata fingerprinting (f31bc71): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset. - Duplicate asset ancestor search (40fb74f): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart. - Presence logical clock (openclaw#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain. - Suspension timer generation (openclaw#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early. - OS tuple-keyed cache (openclaw#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace. - Presence list type guards (3965f6b): callers supply validated arrays; existing normalization still owns their values. Production +40/-228, net -188. Focused migration, asset/cache, presence/caller, approval-publication and suspension/OS tests pass, as do production and infra-test types, changed-file lint, assertion and suppression checks, and zero-cycle checks. Independent final review has no actionable P0-P2 findings. No schema, durability, retention, indexing, permission, recovery or public SDK change is intended. Broad changed-check is not claimed green: the original base reproduces the 455-versus-454 environment budget failure. The initial Web Push Doctor timeout remains unattributed; all Web Push production hunks were dropped and its exact test passed on restored source. Full build and hosted CI remain unrun. * refactor(agents): simplify reply preparation and refresh bookkeeping Share typed actor-store adapters and prepared async auth reads. Reuse the admitted memory-flush plan, retain last-good catalog views by provider, and remove unused metadata bookkeeping and config projections. Preserve live credential/effect authority, FIFO, transcript durability, and ordinary write settlement. Net production reduction: 303 lines. Best-effort tradeoffs accepted: - Plugin-drain successors (openclaw#162301, synthetic): wait the current drain once; a later reload owns its own publication and recovery. - A changed memory-flush plan during preparation (openclaw#162177/openclaw#121157, synthetic): finish with the admitted plan; the next turn resolves again. - Per-row catalog freshness (openclaw#158113, synthetic): failed discovery retains the provider's last-good configured and supplemental overlays until success. Existing auth/profile/source gates and successful-empty replacement remain. - MCP sibling invalidation during discovery (openclaw#138694, synthetic): a listing may briefly be stale; the next read observes the invalidation. - Passive context metadata supersession (openclaw#119607, synthetic): late discovered metadata may win until refresh. Keep the single current-promise check before replacing configured limits, preserving the human capacity fix (openclaw#39857). - Registration-time question answers (openclaw#110372/openclaw#134003, synthetic): a prompt can briefly race the answer; its terminal signal closes delivery. - Duplicate or never-attached internal question registrations: both real producers attach once synchronously. Unsupported misuse loses its extra diagnostic/disposal wakeup; ordinary lifecycle rejection remains. - Cancellation publication once/must-consume flags (openclaw#161124, synthetic): the sole internal producer invokes once. Keep active-scope/effect authority. - In-flight placement-service replacement (openclaw#164744, synthetic): use the captured startup service, with its observation and writer authority intact. - Compaction callback rebinding (openclaw#146732/openclaw#163264, synthetic): current work retains its captured callbacks and live assertion; later work captures anew. - Re-entrant logging between synchronous run-owner checks: openclaw#162227 removed the awaited retry, making the second check redundant. Real post-await and mutation-effect checks remain. - Startup diagnostic admission (openclaw#146792): the sole producer checks lifecycle immediately before recording. Remove only the recorder's duplicate check; preserve the human abort/recovery fix (openclaw#146692), reset, and admin redaction. Release-note context: verbose diagnostics no longer include suppressed reply text or background bash command contents. Execution and user replies remain unchanged. Config show uses the same schema-aware redactor without cloning an already detached result or redacting unused snapshot views. Validation: touched core, messaging and Gateway-method type graphs passed; 49 changed TypeScript files passed targeted lint/format; runtime and Madge cycles are both zero. Auth reader, question authority, memory flush, restart claim, catalog worker, cancellation and compaction boundary proof is recorded in the lane ledger. Final supplemental run: 392 tests passed, four failed across 28 files, with final source verification. All 120 agents-support tests passed, including refresh coalescing, publication, run-wait and compaction. The four failures were an unchanged 120s ACP reset deadline and three MCP fixtures settling before child startup markers (empty logs, existing 1-2s connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset and two MCP cases; the one-second MCP retirement fixture still failed before its first child marker. Clean lane-base comparison could not reach assertions: the temporary checkout lacked workspace-local dependency links for worker compilation. That case is unresolved, not proven inherited; coordinator-bundle CI must adjudicate it. No deadline, retry, skip or assertion was weakened. The final selected real-dispatch suppressed-reply logging regression passed with completed source verification (one selected case, 202.58s wrapper). Independent P0-P2 review completed four passes. Declined duplicate findings about unsupported placement-service hot-swap (real observation/database/writer authority remains) and alleged run-wait awaits (only synchronous logging lies between the checks; real mutation and post-await checks remain). Broad check-changed is NOT green: env-name budget 455/454 also fails on the unchanged lane-base index, with no added env names; production/full-tree Knip hit their existing 600s budget; the silent legacy-store scan was interrupted after 782s. Those two scans are missing proof, not attributed inherited reds. Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy fixture findings were corrected and their targeted replays pass. No changelog, dependency, database schema, durability, retention, permission, or public API change is included. BELOW-500 branch-only coordinator handoff; no lane PR or merge. * chore: shrink stale reply assertion allowance * test: align catalog publication calls with current contract
What Problem This Solves
A memory plugin that does not store workspace files cannot persist the pre-compaction memory flush.
User Impact
The memory slot owner can persist the flush through its own tools. Optional read-only lookup tools let the flush check existing memory instead of re-saving the same facts.
Existing installs are unchanged. With Memory Core as slot owner, the workspace memory file and the flush requests are byte-identical to main's (proof case 8), and
runtime-only plugins' flush plans run in main's order.SDK compatibility:
flushPlanResolverandMemoryFlushPlankeep main's exact contract: the resolver still returns a completeMemoryFlushPlanornull, so released producers and null-checked consumers compile and behave the same. Memory Core keeps main's resolver code unchanged. A new optionalproviderFlushPlanResolverreturns plans the host completes: aMemoryFlushFilePlanDraftwhose omitted timing the host fills, or aMemoryFlushToolsPlan. The host prefers it when a plugin registers both. Released hosts ignore the new field, so a plugin using it gets no flush on them rather than a tools plan in the file-plan field.Intended: the host now honors
agents.defaults.compaction.memoryFlush.enabled: falseforruntime-only plugins' flush plans, which main ignored.Why This Change Was Made
The tools arm is limited to the selected slot owner. It runs in a detached session with:
flushIdthat includes the source session's lifecycle revision, so a reset session gets a new id while a retry within one compaction cycle keeps the same oneA flush succeeds only after a real persistence tool call or
NO_REPLY. The post-turn maintenance flush takes the source turn's trusted owner fact for audience resolution only; maintenance runs gain no owner tool authority. The host resolves flush timing once.Evidence
Live proof on an isolated Gateway, with the default context engine and the real Knowledge plugin. Proof build
e57ddfeeaadon maind7fd9a7dea1; it is runtime-identical to the pushed tips. The pushed tips were rebased onto newer main through a mechanical method-list conflict, andprotocol:checkplus the method-list and memory Gateway tests pass on them.Results and redacted traces
Build: stack ; candidate
e57ddfeeaad(base for upgrade/compat cells:d7fd9a7dea1). Isolated Gateway on its own port,HOME,OPENCLAW_STATE_DIRandOPENCLAW_CONFIG_PATHunder a scratch directory, launched withenv -i(no provider credentials, no access to the operator's~/.openclaw).Harness (real entry points, deterministic model):
chat.sendRPC (operator withoperator.admin, as the Control UI owner connects) and through the bundledqa-channelplugin polling the repository's QA bus (group conversation, non-owner senderstranger). Children are created by the model calling the realsessions_spawntool; resets usesessions.reset./v1/chat/completionsserver configured as a normalmodels.providersentry. It emits the tool calls named in the user message (through the default Tool Searchtool_callsurface) and can hold a response on a named gate so a reset can land between audience minting and tool dispatch. Admission, tool dispatch, flush planning and compaction are all product code.feat/provider-neutral-memory, built against this OpenClaw build) with its own store under the isolated state dir. A pass-through tap module loads Knowledge's unmodified entry and records, at the provider boundary, the host-suppliedmemoryAudience/memoryFlusheach provideropen/search/get/candidatescall and Knowledge tool execution received and whether Knowledge returned or refused. It never changes arguments, results or errors.[provider]lines below come from it;[model#n]lines are what the Gateway sent to the model (including any Active MemoryprependContext);[gateway]lines are the Gateway's own file log.main/direct chats so lane-1 trigger recall (provider.candidates→prependContext) is observable.<uuid#n>).@@usage).forceFlushTranscriptBytesis raised so transcript size does not trigger flushes.Results
flushIdowner-private, stored inprivate/sessions.reset, the next flush'sflushIddiffers from the previous incarnation's5. Owner flush on compaction
Commands:
sessions.reset main;chat.send main "warm-up turn";chat.send main "FLUSHMARK-OWNERPRE … <~198k chars>".The page title reads
FLUSHMARK-NONEbecause the scripted model found no marker in the flush turn's input: the marker sits in the pending prompt that triggered compaction, while the flush works over the existing transcript.Decision point: preflight compaction admits the turn, its
beforeCompactionhook runs the flush, the source audience (owner-private) is delegated to the detached flush session, the flush turn sees only the plan's lookup tools,knowledge_save_pageandread, and Knowledge records the write with the delegated audience andflushId, in the private partition.5b. Post-turn maintenance path
Command:
sessions.reset main;chat.send main "FLUSHMARK-OWNERPOST long owner turn\n@@usage 45000".Decision point: the flush reached through optional post-turn session maintenance resolves the same
owner-privateaudience as the compaction path and the page lands inprivate/. (On the earlier dry-run build this path delegated aconversationaudience and misfiled the page; case 6 shows a non-owner source still getsconversation.)5c.
flushIdper incarnationDecision point:
sessions.resetwithreason: "reset"keeps the session id and restartscompactionCountat 0; theflushIdnow also covers the source lifecycle revision, so the new incarnation's flush (and Knowledge's derived saverequestId) cannot collide with the previous one.6. Non-owner (group) flush
Command: QA bus inbound to group
flush-roomfromstranger:"FLUSHMARK-GROUPPOST …\n@@usage 45000".Decision point: the delegated audience is the group's
conversationaudience, so Knowledge stores the page under that conversation's partition; nothing is written to the private partition. Knowledge has no model-facing scope selector, so a conversation flush has no way to address the owner partition.7. Revocation while the flush is pending
The scripted model holds the flush turn's first response (
POST /control {flushGate}) after the flush session and its delegated audience exist; the harness then resets, then releases.7a. Source reset, pre-compaction flush
7b. Source reset, post-turn flush
7c. Captured ancestor reset, child session flush
Commands: spawn
CHILD-D;chat.send <child> "FLUSHMARK-CHILDREVOKE …\n@@usage 45000"with the flush gate armed;sessions.reset main; release.Decision point: resetting the source session itself cancels the flush's owner (the turn in 7a, the maintenance writer admission in 7b) before any save executes. When the reset hits a captured ancestor instead (7c), the flush keeps running, but the delegated audience shares the ancestor's generation lease, so the
knowledge_save_pagecall fails withmemory audience is no longer currentbefore Knowledge runs, and the flush ends withno persistence tool call succeeded. No note with the marker exists in either partition.8. Memory Core file plan, unchanged
Same script on both builds with
plugins.slots.memory = "memory-core": post-turn flush (@@usage 45000), thensessions.reset, warm-up and a compaction-crossing prompt.Candidate
e57ddfeeaad:Base
d7fd9a7dea1:Decision point: the file plan still exposes
read/writeonly, uses the same prompt, and appends tomemory/<date>.md; the workspace file and the full flush request projection (tools, prompt with the time line normalized, model response) are byte-identical between the builds.Regression tests:
memory-core-host-runtime-core.flush-plan.test.ts: a released consumer that null-checks aflushPlanResolverresult still gets a completeMemoryFlushPlan, andproviderFlushPlanResolveraccepts released plans, file drafts and tools plans. The consumer check fails against the previous widened resolver.memory-state.test.ts: across sidecar merges in either order, the owner's resolver of either kind wins as a unit, and a sidecar's plan is never credited to the slot owner.agent-runner-memory.tools.test.ts: owner-private vs conversation per source, and a newflushIdper incarnation.command/maintenance.test.ts: the post-run owner fact.agent-tools.memory-flush-writer,memory-flush-plan, and memory-coreindex.Stored data and upgrade: no schema, migration, or new persisted field.
memoryAudienceSenderIsOwneris an in-process field that session maintenance sets on the run it builds; when it is absent, the flush resolves a non-owner audience, so it fails closed. TheflushIdis derived on each flush from the session id, lifecycle revision, and compaction count, and the host does not store it. Existing Memory Core andruntime-only installs keepflushPlanResolverand main's flush behavior (case 8).Gates on the final tree (
2892d23c9db, rebased onto main after #162176 landed):tsgocore, core-test, extensions and extensions-test lanes;plugin-sdk:check-exports;plugin-sdk:surface:check;loader.test.ts: passProof on this tree: the live traces above ran before the resolver split. Two things differ from that proof build. Knowledge registered its tools plan through
flushPlanResolver; the host now reads both fields through one resolver source, so the flush path it exercised is unchanged. Memory Core returned file drafts; it now runs main's resolver code unchanged and returns complete plans, whose values the host uses as given. Case 8 was not re-run on this tree. Knowledge moves its plan toproviderFlushPlanResolverin a follow-up.🤖 Generated with Claude Code