Repository navigation
fix(memory): prevent forgotten session content from returning - #130451
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 6:20 PM ET / 22:20 UTC. ClawSweeper reviewWhat this changesThe PR coordinates memory deletion with backfill, indexing, dreaming, and session provenance so forgotten session content cannot be staged or published again. Regression provenancePossible regression — probable (reproduction; reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep this maintainer-owned PR open for exact-head CI and live operator proof. The source and regression tests support the root-cause repair; no discrete correctness defect was found in the reviewed paths. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherMemory Core converts session transcripts into staged candidates, search-index chunks, and dreaming output. flowchart LR
A[Session transcripts] --> B[Backfill and dreaming ingestion]
B --> C[Staged memory and index work]
D[Memory forget] --> E[Session tombstones]
E --> B
C --> F[Search and dreaming output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +171, Tests +832, Docs +144, Other -1. Total +1146 across 38 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the unified tombstone-and-publication fence after exact-head checks and a redacted after-fix deletion/reindex or Gateway backfill run demonstrate that forgotten content stays absent. Do we have a high-confidence way to reproduce the issue? Yes: focused source tests pause embeddings or narratives, issue a forget operation, then assert that staged entries and index content are not republished. Is this the best way to solve the issue? Yes: the repair records lineage at staging, uses durable tombstones, and revalidates those facts at the publication owners rather than adding downstream search filters. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 86e208310ff2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
After-fix operator proof passed on head The first recording shows admission-aware backfill: both conversations were eligible initially, then the configured The complete flow passed all 21 CLI/RPC commands plus the UI actions. Dry-run left origins unchanged; apply removed two staged entries, four origin rows, one search chunk/source, and the corresponding FTS, vector, and embedding-cache rows. Forced reindexing and subsequent Gateway backfill did not restore the selected content. An unselected conversation remained searchable, and both original transcript hashes and history responses were unchanged. The runtime came from the successful exact-head CI run; its merge-ref build has the same source tree as the PR head. The clean Linux container has also completed its frozen-lockfile install and full CLI/plugin/Control UI build at the exact PR head. The reviewer’s earlier help-command result was a 30-second cold-build timeout; the built CLI help and the real commands above succeeded. A separate Linux run is now checking deletion while actual embedding/index publication is pending. Both recordings contain only synthetic QA data and were inspected before upload. No credentials or private state are included. backfill-policy.mp4forget-and-no-readmission.mp4 |
|
The pending-publication live proof now passes on exact head This additional run used a fresh For controlled timing, the harness observed the actual embedding-start debug log, sent SIGSTOP to the owned CLI launcher and its respawned worker, and independently verified both were stopped, no workspace lock was held, no index chunks were published, and one unpublished shadow database existed. It then ran real CLI forget and resumed those same processes. There were no database writes, source hooks, mocked responses, or altered runtime startup flags in the harness.
All nine commands in this final race flow matched their expected outcomes, including the intentional stale-index exit 1, with no timeouts. The ordinary 21-command CLI/Gateway/UI flow also passed on Linux, in addition to macOS. The unchanged 10-second workspace-lock timeout was not reached: embedding work did not hold the mutation lock, and deletion did not steal a live lease. Deterministic tests cover the remaining file/report/narrative races and nested lock lifetimes. Harness-only retries corrected explicit multi-agent ownership, debug-log visibility, and the launcher/worker process-group distinction. No product source changes were made after the reviewed and tested head. |
|
Merged via squash.
|
* origin/main: (26 commits) fix(plugins): preserve registry epoch on activation rollback (#129232) refactor(plugins): make discovery invocation-owned (#130486) feat(ui): save appearance preferences per user profile (#130340) fix: Buzz bots recover relay stalls and reject revoked senders (#130467) fix(code-mode): serialize catalog handles nested in final values (#130276) fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427) fix(agents): read the published model catalog owner from session_status (#130277) fix(channels): preserve long presentation text (#130368) fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325) refactor(plugins): unify setup registration and artifact selection (#130474) fix(memory): prevent forgotten session content from returning (#130451) refactor(outbound): consolidate transport completion (#130460) fix(workers): protect in-flight workspace manifests from concurrent retention (#130449) fix(portals): keep worker previews reachable and owned by the active environment (#130434) fix(config): keep core channels keys in the generated config schema (#120736) chore(deps): refresh dependencies after seven-day cooldown (#130296) fix(agents): remind exec models to quote shell metacharacters (#125485) fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437) fix(openshell): preserve file writes during concurrent mirror commands (#130447) fix(workers): report full nodes as at capacity, not offline (#130445) ...
Closes #130409
What Problem This Solves
Fixes an issue where users running
memory forgetcould retain session-derived candidates or see forgotten content return after indexing or dreaming finished. Historical backfill also ignored configured admission exclusions and did not reliably retain every source origin when identical claims were coalesced. Prefix-shaped session references could select an unrelated longer session ID.The affected operator surfaces are the memory CLI, session backfill in the Control UI, and automatic dreaming. The provenance docs previously described broader erasure guarantees than these paths provided.
Why This Change Was Made
The memory plugin now shares one workspace mutation lock across ingestion, staging, promotion, diary/report updates, and deletion. Index publication rechecks exact session tombstones and current file content at its commit boundary, including completed shadow rebuilds; pending narratives recheck tracked source entries and the diary context supplied to the model before publication. Embedding and model requests remain outside the lock.
Backfill uses the same configured admission policy as automatic ingestion, records each source origin before publishing its candidate, and preserves coalesced-claim deduplication. Session reference matching uses the canonical exact-ID/archive filename contract. The refactor removes the separate diary lock and duplicate grounded-staging path; it reuses the existing SQLite lock namespace and index revision without adding a table, schema version, configuration key, or dependency.
Production LOC: +965/-794 (net +171). Tests: +1024/-192 (net +832), including an existing curated-write suite moved into its owning test file. The added production code enforces publication and reentrant-lock lifetime boundaries; the duplicated recorder and old lock implementation were removed.
User Impact
Admission exclusions now apply to CLI and Gateway backfill preview, REM, and apply. Forgetting an exact session removes its tracked candidates and derived artifacts without selecting prefix neighbors, and in-flight index, phase-report, and narrative work cannot restore removed inputs. An invalidated index run reports a retryable source change; a stale narrative records an intentional skipped outcome.
The docs now lead with a dry-run workflow and explain the actual limits. Original transcripts and archives, unrelated agents' stores, old untracked memories, and unattributable freeform/paraphrased text are not blanket-erased. Direct tools and external writers do not participate in the memory plugin lock. Existing admission lists still do not govern raw transcript indexing or direct file writes.
Evidence
Verification limits: phase-report/narrative timing and nested lock lifetimes have deterministic failing-before/passing-after coverage; the real provider race exercises index publication. Local shared-install IMAP/
pakogaps were resolved as validation gaps by clean hosted checks and the clean Linux build. Remote test infrastructure was unavailable, so live proof used isolated host state and an ephemeral local Linux container. Harness-only retries corrected multi-agent config, debug logging, and respawned process-group targeting; the product head did not change.Provenance: the admission/deletion contract was introduced by #130151 on 2026-08-26, commit
9d9dc3127521d556c37865e4f78ba20ee95fe8e3(code author, PR author, and merger: @steipete). Reproductions are against current-main development code; this PR does not claim a confirmed stable-release regression.