Skip to content

Deleted memory stays refused and digests require current source facts - #1114

Merged
zlareb1 merged 5 commits into
mainfrom
fix/memory-consent-and-digest-provenance
Nov 21, 2026
Merged

zlareb1 merged 5 commits into
mainfrom
fix/memory-consent-and-digest-provenance

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Related: #1092
Related: #1103
Related: #1071

Changelog category (leave one):

  • Critical Bug Fix (data loss, cross-tenant read, auth bypass)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Explicit deletion records a permanent value refusal enforced by later extraction, restoration and publication. Session digests require complete, current, eligible source facts before publication and retrieval.

Why

A tombstone does not prevent the same content from being extracted under another key. Checking only a digest's own state also leaves superseded source facts searchable. Both require publication to prove current consent and source state.

Refusals store canonical value hashes and normalized literal fingerprints rather than deleted plaintext in blacklist patterns. Session digest text is reconstructed from complete committed facts; a probabilistic text check cannot establish that every statement remains supported.

Scope and risk

Deletion, versioned deletion, forgetting, clearing and erasure record refusals. A point refusal follows the same user across agents and sessions in its namespace. User erasure covers later namespaces in the organization; namespace erasure covers every user in that namespace. Wildcard forgetting preserves the caller's user and session restrictions.

ClickHouse admission claims and Postgres transaction locks protect policy reads and writes through their final send. Erasure captures authoritative history and dependent content before removing it. Canonical writes and proposals, raw evidence, chunks, extraction jobs, shared publication and vector maintenance enforce the same boundary. Concurrent writes to one key can wait for preceding publications. Unreadable policy refuses publication. Versioned deletion recovery requires the exact checked state, preserving concurrent and colliding writes.

Native delivery settles only acknowledged documents or obsolete sources that need none. Withheld documents retain delivery debt. Canonical publication finishes before the vector send, preventing sibling writers from competing for the same consent fences; audit publication remains concurrent. Receipts match the complete identity and actual publication version before settling the original sequence. Maintenance counts and indexing use those receipts.

Search, export, context assembly and downstream digest consumers revalidate source proof. Missing, changed, retired, expired, sensitive or pending sources withhold a digest. Digest listing, outline and evidence export scan beyond withheld candidates using stable keys; an exhausted scan budget reports an unavailable result rather than a complete listing. Period planning selects one newest live digest per session before reading bounded pages and preserves window boundaries. Source qualification applies to each digest row, so one model cannot admit a stale peer from its session. Model-generated period and contrast memories remain proposals. Postgres CI runs storage and authenticated-isolation profiles in separate jobs on both supported versions, with independent stores, identical test commands and unchanged one-hour limits; restore drills remain last in storage.

Compatibility, rollout and rollback

  • Schema: additive ClickHouse migration 115 creates the refusal table without a TTL and adds the checked-state hash to deletion checks. Postgres migration 014 creates its refusal table. Erasure classifications and architecture docs describe both stores.
  • Wire behavior: memory.restore and snapshot restoration refuse removed content with VALIDATION_FAILED, reason forgotten. Automatic retirement remains reversible without refusal. Evidence import skips unproven digests; include_high never bypasses source verification. No wire fields are added or removed.
  • Settings: memory_session_digest_max_input_chars bounds complete source facts instead of transcript input. Its name and default remain unchanged; facts are never clipped. Session digests make no model call. memory_digest_listing_page_size and memory_digest_listing_max_pages expose the listing scan bounds; both default to 256.
  • Rollout: finish pending versioned deletion checks, then stop and drain older APIs, workers and command-line writers before migration. Keep writes paused until every publisher enforces refusal. Schema compatibility alone cannot make an older writer enforce the new policy.
  • Historical deletions have no reconstructed refusal record. Establish intended refusals from surviving deletion records when historical coverage is required. Canonical and literal fingerprints cannot recognize arbitrary semantic paraphrases.
  • A legacy deletion check without a checked-state hash cannot create a missing tombstone. Retry deletion against the current state.
  • Rollback: keep writes paused; an older writer does not enforce the consent boundary. Additive schema objects remain.

Tests

  • Pushed-head CI: 58 of 61 checks completed with success or expected skips; none failed. All six unit shards, combined coverage and module floors, the offline benchmark suite, all four ClickHouse integration shards, authenticated isolation on both authorities, mixed-version compatibility and both quickstarts pass. Postgres 16/18 storage and trigger acceptance remain running. The requester explicitly authorized merging after independent agent approval without waiting for these CI jobs.
  • make format lint typecheck: passes, including generated artifacts and ratchets. Actionlint passes for the workflow partition.
  • 398 focused checks pass for publication, digest listing, settings defaults, statement inventory, workflow wiring, documentation and public text. Further focused cases cover source qualification, period pagination and review corrections. The requester waived another complete local unit run; CI runs the complete suite.
  • Three authenticated database regressions pass for digest listing, outline and evidence export. Live period regressions cover selecting one model per session and paging past older model rows. The analyzer and focused SQL cases pass on 2,292 statement shapes.
  • Publication acknowledgment regressions fail against the previous publisher code and pass with receipt-based settlement. A deterministic regression reproduces competing sibling publishers; ordered sends pass it and a stream of 600 real Postgres writes with the original request lease and projection wait.
  • pytest bench -q: 251 passes with fake providers.
  • make test-mixed-version BASE=9b960bb885d4b51486f372585dec144f481cfd43 REQUIRE=1: passes cross-build writes, column preservation, private-event isolation, dashboard assets and worker handoff. CI repeats the compatibility gate against its selected base.
  • Fresh schema migration and schema checks pass. The unchanged Python SDK bytes pass the Python 3.11 wheel smoke test at lowest direct dependency versions.

Projection fixtures require an acknowledged seed whose hash covers the full served value. Resolver audit assertions distinguish recorded dead-peer cleanup from model decisions; every model action retains its confidence threshold. The rate-limit check retains concurrent calls, one bucket, its deadline and every success assertion while using distinct keys. Native lease fixtures establish publication before replacing their setup revision. Erasure retains its active-publisher scenario and allows a maintenance read budget for draining publishers and completing mutations.

The Postgres workflow partition preserves all five pytest commands, filters, versions, setup and per-job deadlines. Independent review verifies the partition and that restore drills seed their own data. Three additional native profile-render checks expose an asynchronous read race in unchanged code; their assertions remain untouched and they are outside the required storage profiles.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex. Independent agents reviewed refusal scopes, erasure capture, deletion recovery, source verification and publication acknowledgments.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local gates and integration profiles pass; review corrections have targeted verification, with another complete local unit run waived by the requester.
  • Fresh independent agent review approves the pushed head with no findings or nits.
  • All CI checks complete: waiting for the remaining three jobs is waived by the requester.
  • Migrations are additive; content-bearing stores remain covered by erasure.
  • Generated schema, operation descriptions and statement shapes are updated.
  • Architecture docs describe refusal scopes, source proof and the restore break.
  • Public text contains no deployment details.
  • Commits are signed off.

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 21, 2026 4:51pm UTC

Request Review

@zlareb1
zlareb1 force-pushed the fix/memory-consent-and-digest-provenance branch 2 times, most recently from fd80db0 to f2d4e3d Compare November 21, 2026 15:39
Persist value refusals before explicit removal and fence memory, extraction, restoration and projection writes through publication. Rebuild session digests from complete eligible source facts and verify that proof before serving them. Settle native delivery only for acknowledged rows so withheld projections remain owed.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Fill listing pages from proven sources so stale candidates cannot hide current facts or falsely report completeness. Bound keyset scans and refuse an unfinished scan; cover listing, outline and evidence export against the database.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Select one latest live digest per session before applying the page cursor, and retain qualification per row so another model cannot admit stale text. Expose listing scan bounds as settings instead of hidden tuning constants.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Both content sends acquire the same consent fences, so concurrent acquisition can split their claims and stall the flush. Keep audit publication concurrent and preserve independent receipts after a failed canonical send. Pin the new listing settings and cover their page size.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The serial suites reach the shared job deadline even when their tests pass. Independent profiles retain every command, both Postgres versions and the same timeout; restore drills remain last in storage and log artifacts name both matrix dimensions.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 force-pushed the fix/memory-consent-and-digest-provenance branch from f2d4e3d to 8d3d306 Compare November 21, 2026 16:48
@zlareb1
zlareb1 merged commit fc85961 into main Nov 21, 2026
60 of 61 checks passed
@zlareb1
zlareb1 deleted the fix/memory-consent-and-digest-provenance branch November 21, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant