Skip to content

run.reliance lists what a run read, at which revisions, and what its client reported relying on - #2182

Merged
zlareb1 merged 31 commits into
mainfrom
feat/reliance-report
Dec 5, 2026
Merged

zlareb1 merged 31 commits into
mainfrom
feat/reliance-report

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Part of: #1760
Related: #2137

Changelog category (leave one):

  • New Feature

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):

run.reliance lists what one run read, at which revisions, and what its client reported relying on, with one state per item: returned, reported, reported_and_served or not_recorded. The dashboard's run detail shows the same list in a section "What this run read".

Why

A run's read receipts record what Loom served it, and memories_used is the client's own statement of what it relied on. Without the op the two are read apart: the receipts with SQL, the report through run.get. A reader who joins them by hand has to decide what a report with no receipt means, and each client that does so decides differently.

run.reliance joins them in one place. One pure function (server/tasks/domain/reliance.py) derives the state of each item, the handler is its only caller, and every surface reads the op. No state means a mismatch: a read can leave no receipt (receipts off, expired, a mirror leg, another label), so a report with no record reads not_recorded, never "not served".

Design in brief:

  • The op. run.reliance, viewer, read-only, idempotent, experimental, not audited, budget 300 ms, in no MCP roster. Input org, namespace, run_id. Output found, items[] (kind, key, state, revisions[].versions, last_served_at), truncated.
  • Two reads. The run's row in loom.agent_runs, then one grouped read of loom.read_receipts under the caller's (org, namespace) and the run's id. A namespace with no such run answers found: false and reads no receipt.
  • One row per item, the reported keys first, then the items served most recently. A report holds at most 500 keys and the answer 500 recorded items, so a cut answer keeps every reported item's receipts.
  • Pairs are sorted before they are cut. An item keeps its 32 highest (hash, version) pairs. An aggregate that stops at the first pairs it meets can drop the newest revision and answer differently between calls.
  • No time bound. A read can carry the run's id before the run's row is written and after the run closes; a window would print not_recorded for a record that exists.
  • Versions, not hashes. The server groups and matches on the stored hash and answers a revision by its stored versions, as decimal text (a memory version is a write time in nanoseconds, above 2^53). A receipt keeps the hash of a row that is redacted or labelled high-sensitivity after the read, so the answer prints none. No reader column is selected.
  • A failed receipt read fails the op. A partial list would print not_recorded for a receipt that was not read.
  • The receipt read is caller-shaped. A run id on a read is client input, and the aggregate grows with the receipts that carry it, so the statement runs under the caller-shaped ceilings (LOOM_CH_CALLER_SHAPED_*: 30 s, 4 GB and 500 M rows read by default) and, where LOOM_CH_READER_USER is set, as the reader user. A read past a ceiling answers 422 with "narrow it (one run id for each run)"; without the ceilings a memory refusal of the statement is a 500 with no hint. The lists of the caller-shaped reads name run.reliance: the settings reference, the settings file template, the ch_reader_user_failing problem and the Read-only user bullet of docs/operations/deployment.md.

What is listed, by caller:

Caller Its reads are listed when
Any HTTP client The body names the run (run_id) or the request carries X-Loom-Run-Id.
The Python SDK In a run scope, memory.search and memory.ask carry the header, and memory.get, memory.bulk_get and context.pack carry the run in their body; memory.get_by_id, procedure.match and the document reads carry neither. With auto_run and no scope open, every memory.*, working_memory.*, observe.* and context.* read carries the header; procedure.match and the document reads carry none.
The Rust SDK The client is bound to a run.
The TypeScript, Go and Ruby SDKs The call's input names the run; these SDKs send no run header.
An MCP session The read is one the session's run labels. It is listed under the session's run, not under a run the agent opened with run.begin, which lists the reads that name it. That run names the session's run in metadata.session_run (run.get), and the op reads the one id it is given, so an agent calls it once for each id.

Not listed: a read that wrote no receipt, an item of another namespace, a read older than the receipts' lifetime, which passage of a document was served, and who read (a run id on a read is client input, so the list can hold another caller's reads of the namespace's items under the same id).

A run that a plugin's hook opens lists the items of the context packs the hooks requested. The agent's own reads over MCP are filed under the session's run, a second row of the Runs list, and the hook's closing run.complete names no memory, so that run holds no report afterwards. Linking the two is a follow-up owned by the run-label work, not this change.

Alternatives rejected, with their cost:

Alternative Cost
Print content_sha256 The hash of a later redacted or high-sensitivity row reaches every viewer for the receipts' lifetime, for a value no client can join on.
Add items to run.get Every run.get pays the bloom read inside its budget, and a failed receipt read fails the replay.
A time window from the run's row A false not_recorded for reads labelled before the window. Kept as the one lever if the op exceeds its budget on a deployment.
A copy of the receipts keyed by run A second table to erase, with its own erasure step.
Derive states in each client, or return raw receipts Two derivations drift; raw rows carry the reader.
Classify the op for narrowed tokens A run's receipts name rows other users wrote; no filter on the run's identity removes them.

Later slices, each its own pull request: a run opens by its address in the dashboard; a run that names a session's run lists that session's reads made while it was open; memories_used entries carry the version relied on, which makes reported_and_served reachable from the wire and changes run.complete.

Scope and risk

  • Nothing is stored: no table, column, migration, setting, worker or cache. Erasure and rolling upgrades need no new rule: a build without the op answers 404 over HTTP, and the dashboard then draws no section.
  • Reads loom.agent_runs and loom.read_receipts under the caller's (org, namespace). The op is in neither set of ops a narrowed token may call, so a token narrowed below the namespace is refused before the handler, as for run.get.
  • Left alone: run.get, the Recalled figure, recalled_keys, memory.outcome_run, the run-label work, and the "Memories the agent relied on" chips of the run detail, which stay when the read fails. The op does not read metadata.session_run, which a run opened over MCP records: it lists the receipts under the one id it is given.
  • Cost grows with the receipts the namespace keeps (the read tests the bloom filter on every granule of the namespace) and with the receipts that carry the run's id (the statement groups them all before its LIMIT). Measured below. The caps of the answer (500 recorded items, 32 (hash, version) pairs an item) do not bound the read; the caller-shaped ceilings do.
  • The per-item cap counts pairs, not versions: a version read with and without its hash is two pairs and a receipt that names no revision is one, so an item past its 32 pairs can list fewer than 32 versions, or every version the record holds, with truncated true.
  • Over MCP an answer leaves out its empty fields, as every op's does: a not_recorded item has no revisions and no last_served_at key there. The items and states are the same on every surface.
  • Three edits outside the feature:
    • The knowledge factory guide (docs/guides/knowledge-factory-workflow.md) and two comments, one in the example and one in its unit test, said that no op serves a read's receipt. They say that run.reliance lists the revision a run was served and that the example does not call it. The example's calls, its revision_receipts coverage entry (needs: read_receipts_op) and expected.json are unchanged, so its result is too.
    • refreshDetail moves from frontend/src/lib/format.ts to frontend/src/lib/refreshDetail.ts. Only the lazily loaded Code view calls it, so it is built into that view's chunk and not into the entry chunk, which lib/format.ts is part of (figures below).
    • The message of the ch_reader_user_failing problem (/v1/health, loom doctor) and its docstring name run.reliance among the reads that fail while ClickHouse refuses the reader user. The problem's code, severity and fix text are unchanged.

Compatibility, rollout and rollback

  • Wire: one op added, run.reliance (experimental). No field, default or existing op changes. sdk/python: RunClient.reliance(run_id); the generated call in the TypeScript, Ruby, Rust and Go SDKs.
  • Dashboard: the run detail gains the section "What this run read"; the inferred-run notice and two "Recalled" help texts are reworded so they do not say the run recalled nothing while reads are on record.
  • Operator steps: none.
  • Rollback: reverting leaves no row, migration or setting behind.

Tests

Run locally on one loaded machine, against a ClickHouse and servers started for the run. Main moved while the run went on, and the branch is merged with it four times; the head is the last merge. A result names the tree it ran on where that is not the head.

What the merges needed:

  • The first two merges conflict and the last two do not.
  • The generated wire models conflict: sdk/go/wire/models.gen.go in both and sdk/rust/src/wire_models.rs in the first. Neither is merged by hand: each is written again by its generator, with rustfmt and gofmt from container images of the toolchains at the versions CI pins (Rust 1.85.1, Go 1.27.4).
  • In the second merge server/tasks/app/run.py conflicts in its imports, docs/features/runs.md in its paragraph on the receipts table and in its Operations table, and docs/architecture/read-receipts.md in its list of source entry points. Each keeps both sides.
  • Main now labels every receipted op of an MCP session with the session's run, and a run opened there names that run in metadata.session_run. The "An MCP session" row of "What is listed" in docs/features/runs.md said that no answer gives an agent the id of its session's run. It now says what the table above says.
  • tests/analyzer/shapes.txt is written again after each merge. It differs from main's list by the shape of run.reliance alone.
  • The diff against main holds the same 59 files as before the merges.

Passed at the head:

  • ruff format --check ., ruff check server extractor sdk/python tests scripts .claude, the function-length gate, the secrets check, biome lint frontend/src, Biome format on the changed dashboard files, and Prettier on the changed pages.
  • Every generator with --check: the Python, TypeScript, Ruby, Rust and Go SDK generators, the Rust fixtures, op_reach_census, docs_reference, the three settings generators, the admin routes, the plugin copies, and the standalone and served skill bundles. python -m tests.analyzer.corpus --write leaves tests/analyzer/shapes.txt as committed.
  • make typecheck: 0 errors.
  • Unit, -n 2, 621 passed and 12 skipped, the repository scans: test_package_contracts.py, test_op_transport_contract.py, test_tunable_constants.py, test_store_names_refused.py, test_degraded_unnoted.py, test_public_copy.py, test_doc_links.py, test_agent_instructions.py, test_session_content_senders.py, test_settings_defaults.py and tests/analyzer with no ClickHouse. The 12 skipped are the 10 that need a clickhouse binary on the machine and the two analyzer tests that need a ClickHouse.
  • Unit, -n 2, 3062 passed, 23 skipped and 69 subtests passed, 46 files:
    • Of run.reliance: test_run_reliance.py, test_sdk_run_reliance.py, test_run_ledger.py, test_ch_caller_shaped.py, test_arg_feedback.py, test_op_budgets.py, test_op_reach_census.py, test_op_surfaces.py, test_sdk_surface_contract.py, test_read_scope_admission.py, test_op_inputs_after_gate.py, test_docs_reference.py, test_sql_alias_shadow.py, test_reads_llm_free.py, test_integration_suite_targets.py, test_mcp_listing_budget.py, test_sdk_example_knowledge_factory.py and test_knowledge_factory_example.py.
    • Of the commits merged from main: test_mcp_session_runs.py, test_read_receipts.py, test_run_reads_statement_sql.py, test_cli_surface_snapshot.py, test_proposal_triage.py, test_proposals_read_scope.py, test_conflicts_repo.py, test_cli_knowledge_source_worker.py and test_ch_params.py.
    • The 19 other unit files that name frontend/src or frontend/e2e.
    • The 23 skipped need a clickhouse binary.
  • tests/analyzer: 12 passed against the run's ClickHouse.
  • npm --prefix frontend run build passes.
  • npm --prefix frontend run budget: bundle-budget: OK. The entry chunk is 121,652 characters against the 122,880 budget, 1,228 under, with 120 scripts; the boot scripts are 188.5 kB gzipped against 198 kB. refreshDetail is built into the Code view's chunk, and versionTime and the section into the Runs view's; none is in the entry chunk, which lib/format.ts is part of. The flow reuses useShowMore, a chunk of its own that the entry chunk names once.

Passed at the third merge. The head differs from that tree under server/, frontend/, sdk/, the migrations and tests/integration by the comment of one setting in server/settings/catalog.py:

  • Integration, auth off, one file at a time: tests/integration/test_run_reliance.py (6 passed), tests/integration/test_read_receipts.py (20 passed) and tests/integration/test_mcp_session_run_scope.py (3 passed; its other 4 need auth on). The first two each hold a test that turns receipts off for the deployment, so they do not run beside each other.
  • Integration, auth on: from tests/integration/test_cross_principal_leakage.py, the walk as three principals, the core-set check and two positive controls (6 passed), and tests/integration/test_mcp_session_run_scope.py (7 passed). By hand on the same server: a viewer 200 with found: false, a viewer narrowed to own_user 403, another namespace's viewer 403, no token 401.
  • By hand, auth off, in one MCP session: a knowledge.get, then run.begin, then a memory.get_by_id and a memory.get that names the opened run. run.get through loom_op returned the session's run in metadata.session_run. run.reliance through loom_op listed the document and the memory read by id as returned under the session's run, and only the named read under the opened run.

Passed at the first merge; frontend/ is the same at the head:

  • Dashboard, vitest with two workers and a 60 s test timeout on the loaded machine: 38 files, 419 tests passed. They are the tests of this change's files, of the Runs and Code views, of the dashboard files main changed (the Review queue, the proposals view, Setup, lib/state.ts, api/review.ts), the source-scanning rule tests and the accessibility tests.

Failed: none at the head. At the second merge tests/unit/test_degraded_unnoted.py failed for two handlers of server/knowledge/app/source_access.py, a file this change does not touch, as it did on main at that commit. Main has since listed both, and the scan passes at the head.

Not run:

  • The Playwright suite and the check of the run detail at 375 px and 1280 px: the machine lacks system libraries the headless browser loads. frontend/e2e/fixtures.ts serves the new read to runs.spec.ts, whose replay test waits for the section's table before its axe check, so axe reads the table. tsc -b type-checks the spec, and Runs.detail.test.tsx finds the table in the dialog by the same role and name.
  • make format and make format-check as targets: the machine has no shfmt. Of the formatters they call, ruff ran on the repository and Biome and Prettier on the changed files; the change holds no TOML or shell file.
  • At the head: the integration files and the dashboard tests. They ran at the merges named above.
  • The check of the caller-shaped ceilings by hand, through the server's ClickHouse client: with the rows-read ceiling lowered to 1 the receipt read raised the 422 "the query needs more rows, time or memory than this deployment allows one request; narrow it (one run id for each run)". It was taken before the merges. server/tasks/store/runs.py is as it was then, and test_ch_caller_shaped.py passes at the head.
  • The full unit suite, the full dashboard test suite, the full integration suite, the rest of the leakage file, and the TypeScript, Ruby, Rust and Go SDK test suites (their generated files pass the generator checks). CI runs them.

The receipt read, measured. Taken at an earlier commit of this branch and not repeated at its head: receipted_items and its statement's shape are the same there. One namespace seeded with runs of 20 items over 180 days, max_threads = 2, one run read, figures from EXPLAIN indexes = 1 and system.query_log. Cold is the first read after a restart of ClickHouse; the host's page cache is not dropped. A local measurement of one statement, not a benchmark.

Receipts in the namespace Granules after the primary key Granules the bloom filter keeps Rows read Bytes read Memory Filter test Wall
4.0 M 494 23 188,416 11.4 MiB 5.5 MiB 49 ms cold, 3 to 7 ms warm 209 ms cold, 36 to 55 ms warm
16.0 M 1,961 45 362,295 14.8 MiB 5.5 MiB 48 ms cold, 14 to 38 ms warm 168 ms cold, 49 to 111 ms warm

At 0.9 to 2.4 ms a million receipts, the filter test alone takes the op's 300 ms budget at 125 to 340 million receipts in one namespace; docs/architecture/read-receipts.md carries the range.

One run id reused across a namespace, measured apart on the op of a local server: with 2.0 M receipts of distinct revisions under one id, three calls answer 200 in 1.2 to 1.5 s with 500 items and truncated; the statement reads 2,032,768 rows in 547 to 708 ms and uses 570 to 630 MB. That is under the 4 GB ceiling, so the read still answers; the ceilings bound the case above it.

The plan names PrimaryKey on org, namespace and Skip: run_id_bloom_idx. To reproduce: insert the rows with INSERT INTO loom.read_receipts SELECT ... FROM numbers(N) (20 rows a run, ts spread over 180 days, 50,000 item keys), run the statement of receipted_items in server/tasks/store/runs.py with max_threads = 2 and a log_comment, then read read_rows, read_bytes, memory_usage, query_duration_ms and ProfileEvents['FilteringMarksWithSecondaryKeysMicroseconds'] from system.query_log.

Coverage, not run on a deployment. The share of closed runs that report a memory and have a read on record under their own id, over the exposure ledger:

SELECT environment, JSONExtractBool(metadata, 'implicit') AS session_run,
       count() AS reporting_runs,
       countIf((namespace, run_id) IN (
           SELECT namespace, run_id FROM loom.memory_exposures
           WHERE org = {org:String} AND run_id != '-' AND ts >= {since:DateTime}
       )) AS with_a_read_on_record
FROM loom.agent_runs FINAL
WHERE org = {org:String} AND status != 'active'
  AND started_at >= {since:DateTime} AND notEmpty(memories_used)
GROUP BY environment, session_run

Over the receipts: the same statement with loom.read_receipts in place of loom.memory_exposures. Both are lower bounds: a run closed again with no report is not counted.

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

  • AI-generated (an agent wrote most of the diff): Claude Code. Checked by running the gates listed above; not yet read line by line by a person.

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

Checklist

  • Local format, lint, type checks and focused tests pass, with the exceptions listed under Tests: make format-check as a target needs shfmt, and rustfmt and gofmt ran from container images. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited: no migration.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version: no plugin file changes.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

🤖 Generated with Claude Code

zlareb1 and others added 25 commits December 4, 2026 10:11
After an item changes, the record of which keys a run was served cannot say which revision the run saw. loom.read_receipts holds one row per item of a receipted read's answer: the memory row's version and stored content hash, or the document's revision, with the request, the run and the reader. It holds identifiers and a hash, never content or query text.

The revision is noted by the code that holds the row while the read runs. It is never looked up afterwards and never taken from another row under the same key. The rows queue for one sender per process, which sends one insert each half second, so receipts hold one ClickHouse connection and a fixed insert rate whatever the read rate and never fail or delay a read. A request that runs a mirror leg writes none.

Both erasure scopes cover the table with lightweight deletes, and no row is written while a replica without the erasure step serves. A user's census counts the receipts stamped before the erasure was recorded, so a user who keeps reading does not fail their own erasure.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
The rebase left the shape of main's dump beside the shape of this branch's. The list is regenerated with python -m tests.analyzer.corpus --write.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
… cause and total, and live 190 days

A context pack's receipts are the rows its rendered text prints, at the
version of the search hit each was printed from; an abstaining search's
rows are receipted and not counted as served. search.query receipts its
memory hits from the search's own models, which keep the private row
version.

Each kind of loss (closed replica gate, queue bound, failed insert) is
logged at most once a minute with its total since the process started.
The closed-gate line names its cause and counts only answers that had
rows to record, so the gate is asked when an answer's rows are queued.

Reader strings pass through as_valid_unicode (server/core/hashing.py,
shared with memory.for_file), so a lone surrogate costs no insert. An
unnamed agent is stored as '-'.

A user's erasure counts the receipts stamped up to the second it was
recorded in, and its whole-org counts and delete run under the DDL
deadline.

The table keeps a row 190 days, so every row outlives six calendar
months, and its agent column defaults to '-'.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…isions

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>

# Conflicts:
#	tests/analyzer/shapes.txt
…receipts table

schemas/schema.sql and docs/reference/schema.md carry the 190-day TTL
and the agent column's default. The settings reference, schema and
example carry the setting's comment. The read-receipts rolling-upgrade
rule is rule 74, after the rule main numbers 73, and the rollback note
names it. The design page's log table names the handler in the
per-answer line and lists knowledge.search among the MCP reads filed
under no run.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…answer once, and each read path's note has a test

The time an erasure was recorded is bound once by the saga and by the restore
replay (recorded_scope). The census reads it to the second and the code-index
purge reads it directly, where it read the ledger row on every step.

memory.for_file notes the rows of its answer in the handler, where the rows of
the request's namespaces and of the caller's other namespaces meet, so one call
covers both reads.

search_sections builds the thread-history section in a helper, which keeps it
inside the function-length limit.

Tests: an integration case reads a row by its id, for a file and as a pinned
row of the stack and compares each receipt with the stored revision; unit cases
cover the stack's pinned and recalled rows and the body a procedure match is
built from. Each fails when its note call is removed.

Docs: loom.read_receipts is listed with its own 190 days, and the erasure
section names the deadline to raise, LOOM_CH_TIMEOUT_DDL_S.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…wo more read paths' notes have a test

recorded() answers the second the erasure was recorded in, as the ledger row
holds it, so a first run and a resume bind the same value. The code-index
purge holds for a code worker whose next pass was due anywhere in that second,
on every run.

Tests: an integration case reads a file's block that prints a row the caller
wrote in another namespace and compares its receipt, filed under that
namespace, with the stored revision. The stack's unit case answers only the
columns its statements select. A purge case binds the time as a first run and
as a resume do. Each fails when its behaviour is removed.

Docs: the erasure section names the read deadline's setting.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the purge's hold is tested at its deadline

The stack's two row reads and the file read select `redacted_at` so a redacted
row's receipt carries no hash; no test failed when a statement stopped
selecting it. Each now has a case whose store answers only the selected
columns, for a live row and a redacted one.

The code-index purge waits a deadline past the end of the second the erasure
was recorded in. A clock seam lets a test check the hold half a second before
that end and at it, for a worker's newest row and for a first pass.

The pages said a receipt is written half a second after its answer at the
earliest; a row queued while the sender waits goes out sooner. They now say
within about half a second, and state that the user census compares the
reading replica's clock with the recording replica's with no margin.

The description of `ch_batched_insert_background_wait_max_ms` names the
receipt sender, which waits under it. The integration file's two settings
cleanups check the server's answer and wait for what it serves.
`recorded_at()` no longer floors a value `recorded()` floored, and the
`after_write` docstring covers a detached task.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… copy it was read from

A hit expanded to its whole body is receipted at the read that body came from: the
row of loom.memory, or for a shared row its copy in loom.shared, whose version and
hash the body read now returns (`shared_values` answers a value and a version). A
governed hit keeps the note of the copy the term leg read, and a body the budget
cut keeps its hit's note.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…client reported relying on

A run's read receipts are the record of what Loom served it, and
memories_used is the client's own statement of what it relied on.
run.reliance joins the two in one viewer read: one entry per item, with the
revisions the run was served and one of four states (returned, reported,
reported_and_served, not_recorded). One function derives the state
(server/tasks/domain/reliance.py) and every surface reads it through the op.
No state means a mismatch: a read can leave no receipt, so a report with no
record reads not_recorded.

The answer names a revision by its stored versions, as decimal text, and
carries no content hash and no reader: a receipt keeps the hash of a row
that is redacted or labelled high-sensitivity after the read.

The receipt statement returns one row per item, sorts the reported keys
first and sorts an item's (hash, version) pairs before it cuts them. A cut
answer (500 recorded items, 32 versions of each, truncated: true) therefore
keeps every reported item and the highest versions. It has no time bound: a
read can carry the run's id before the run's row is written and after the
run closes. A failed receipt read fails the op, and a token narrowed below
the namespace is refused, as for run.get.

Surfaces: the wire op, the generated call in the five SDKs and
agent.run.reliance in Python, loom call, loom_op by name, and the section
"What this run read" in the dashboard's run detail. versionTime has its own
module, so the shell's chunk does not carry it.

Tests: unit cases for the function's truth table, the handler, the store
statement's parameters and caps, and the op's contract; integration cases
for each state against a server, for HTTP, the SDK, the CLI and MCP
answering alike, for one run id in two namespaces and for a cut answer; the
cross-principal walk probes the op with a seeded read; dashboard cases for
the section and the run detail.

Docs: the runs page has a section on what a run read, the read-receipts
page a subsection on the op that reads a run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Main added rule 74 for an active worker source registration. The read
receipts rule keeps its text and takes the next number, and the upgrade
runbook's reference follows it.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…eceipt has a test over the wire

A redacted or high-sensitivity row's note marks its hash as withheld, and
no other note of that version adds it: a row redacted between a search's
leg and its body read keeps its version, so the leg's hash named the
removed text. The mark stays in the notes and is never stored.

A row whose stored hash is set is noted without encoding its value; the
value is hashed only where the column is unset. The design page says
which reads hash the value they hold, what a hit served its source
passage records, and that a governed definition of a later page keeps
its hash.

Tests: the keep-reading erasure test runs the erasure again where the
first run ends with loom.read_receipts as its only residue, which the
page documents, and reads the receipts step from the run that completed
(a run that failed on residue lists no steps). The cleanup wait of the
file-lookup test accepts the answer a second clear gets. New unit cases
cover a withheld hash in both orders, a governed hit, a body no read
returned, a shared copy that reads as high, a source passage and a later
page's hits; new integration cases cover a whole body after a touch and
a promoted row's shared copy.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main's changes since the last merge touch no file of this change.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…hat get no receipt

The design page names two more reads that get no receipt: a hit that is
no stored memory row, and a memory.ask answer reused from an earlier one.

A stored hash is read through hash_text where a statement's rows are
noted, and a row whose hash is set returns the column's text without a
second decode. A comment says why the fan-out of search.query hands its
served hits to the handler inside the payload.

Tests: a read made under a token and as no end user is filed under the
token's subject and id, and a user erasure of that subject removes it
while another subject's receipt stays. The keep-reading test waits for
the last read's receipt before it runs the erasure a second time. The
file-lookup test clears its override and waits out one refresh, as the
receipts switch does.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d list

RunReliance is the third importer of useShowMore, so the build makes the hook
a chunk of its own and the entry chunk's preload map gains its file name and
the references to it: 58 characters, where the budget has 24 to spare, and
`npm --prefix frontend run budget` fails.

refreshDetail is in its own module, not in lib/format.ts, which loads with
the shell. Only the lazily loaded Code view calls it, so it lands in that
view's chunk and adds none: the entry chunk is 122,822 characters against
122,880, with 117 scripts in the build either way. The budget script and
RunReliance are unchanged.

The e2e fixture of run.reliance sits above the run.get comment, so that
comment is on its function.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
…d its pages state what bounds it

A run id on a read is client input, and the receipt statement groups every
receipt that carries it before its LIMIT, so its cost is the caller's to
shape: one id on 2 million receipts of distinct revisions costs a call about
600 MB. receipted_items runs inside caller_shaped("one run id for each
run"): a read past the row, time or memory ceiling answers 422 with the way
to narrow it, where a memory refusal of the statement is otherwise a 500 with
no hint. The run row's point read stays outside. The statement is unchanged.

The wire comment, the reference and the runs page give the per-item cap in
its unit, (content hash, version) pairs. A version read with and without its
hash is two pairs and a receipt that names no revision is one, so an item
past its 32 pairs can list fewer than 32 versions, or all of them, with
truncated true. The statement and the cap are unchanged.

RunRelianceInput's first sentence names `run_id`: the loom_op catalogue row
lists no identity key as an argument, so its purpose is where a caller over
MCP learns what to send. The Go models' schema digest follows the docstring.

Docs:
- The runs page: a memory's versions are those of the stored row the read
  held (the memory row's, its search document's or a shared copy's), which
  memory.history does not all list; the Python SDK row names the reads that
  carry a run (header or body, in a run scope and with auto_run) and no op
  that writes no receipt; the answer's bounds are not the read's.
- The read-receipts page: the measured cost of the read as a range with its
  conditions, where the filter test alone reaches the op's budget,
  budget.violated as the sign of it, and the ceilings and the read deadline.

Tests:
- The receipt read alone runs in the caller-shaped scope, and a cap inside
  it is a ValidationError with the hint.
- The bound of run.complete's memories_used is at most DERIVED_LIMIT: a cut
  answer keeps every reported item only while that holds.
- A version read both ways counts twice against the pair cap.
- The cross-surface integration test holds a not_recorded item: the SDK and
  the CLI answer as HTTP, and MCP lists the same items and states without
  the empty fields its transport drops.
- A narrowed token is checked with honours_read_scope, which also covers a
  group key, and three case names say what the cases check.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
…w's set hash is checked once

Each server process sends its own receipts. The test waited for the last
read's receipt, which proves only that the process that served it has
sent. It now runs the erasure again until one completes, and each run
that does not must name the receipts table as its only residue.

row_content_sha256 returns the stored hash when it is set and hashes the
value otherwise, without handing the stored column to live_sha256 for a
second check that could not pass.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main's change since the last merge is to the worker supervisor and its
setting's description; it touches no file of this change by hand.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
run.reliance's receipt read runs inside caller_shaped, so the three
LOOM_CH_CALLER_SHAPED_* ceilings bound it: a read past one answers 422. The
comment above those settings lists the reads they bound, and the settings
reference and the settings file template print it. An operator who lowers a
ceiling for code.grep reads there that the same ceiling refuses
run.reliance.

docs/reference/configuration.md and loom.example.yaml are regenerated. The
settings schema carries no comment and is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
The section that lists what a run read loads from its own request,
run.reliance, after run.get's answer draws the rest of the replay. A test
that waits only for run.get's text can run axe before the table is drawn,
and passes whether or not axe read it. The replay test waits for the table
by its role and name before the axe check, so a replay that draws no table
fails.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
The merge brings in the commits the read receipts change gained after this
branch was cut from it. The hand-written files merge without a conflict:
the two sides edit different parts of docs/architecture/read-receipts.md,
server/settings/catalog.py and the leakage test.

Seven files conflict, all of them derived from the registry or from a
source file's hash. Each is produced again, none is merged by hand:

- sdk/typescript/src/generated/ops.ts, the Ruby op table,
  sdk/rust/src/wire_models.rs and sdk/go/wire/models.gen.go are written by
  their generators, with rustfmt 1.85.1 and gofmt 1.27.4.
- docs/reference/operations.md and docs/reference/status.md are written by
  docs_reference: 388 operations, 274 of them experimental.
- tests/unit/session_content_senders.json pins the SHA-256 of the merged
  sources: sdk/python/loom/memory.py as the read receipts change left it
  and sdk/python/loom/run.py with RunClient.reliance.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main carries the read receipts change as one commit with the content this
branch already holds, so the difference from main is the run.reliance
change alone: the same 54 files as before the merge.

Two pages conflict, docs/architecture/read-receipts.md and
docs/features/runs.md. Main's text of both is the text this branch was
built on, so each keeps this branch's side: main's page plus the sections
on run.reliance.

Every generator of an op and of a setting, and the analyzer's shape list,
is run again on the merged tree; each file is current.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
run.reliance's receipt read runs inside caller_shaped, so it runs as
LOOM_CH_READER_USER and fails while ClickHouse refuses that user. The
comment above the ceilings in server/settings/catalog.py lists it; two
other lists of the same reads left it out:

- the docstring and the message of _reader_user_problems
  (ch_reader_user_failing in /v1/health and loom doctor), which tell an
  operator which ops fail;
- the Read-only user bullet of docs/operations/deployment.md.

The three lists name the same five reads.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main gained three commits while this branch was merged with it: reads
over MCP filed under the identity the call names, the receipts that land
after an erasure's census counted by loom erasure-re-verify, and ledger
rows that store a string UTF-8 cannot encode. None touches a file of
run.reliance by hand, and the merge has no conflict:
docs/architecture/read-receipts.md and tests/analyzer/shapes.txt merge on
their own, each side in its own lines.

Every generator of an op and of a setting, and the analyzer's shape list,
is run again on the merged tree; each file is current.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main gained the knowledge factory example, its guide and its tests. They
share no file with run.reliance, and the merge has no conflict.

Every generator with --check and the analyzer's shape list are current on
the merged tree.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 4, 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 Dec 5, 2026 1:49am UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 1:49am UTC

Request Review

zlareb1 and others added 4 commits December 4, 2026 23:41
…n was served

The guide and two comments, one in the example and one in its unit test,
said that no op serves a read's receipt. `run.reliance` lists the versions
a run was served, and the example does not call it. The guide says so in
its table of what Loom enforces, in its paragraph on `not_read` and in its
coverage table, and the table's row links to "What a run read" in
docs/features/runs.md.

The example's calls, its `revision_receipts` coverage entry and
expected.json are unchanged.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`useShowMore` takes the type of the element that holds its rows. The
section passes `HTMLTableElement`, reads the rows from the argument of
`rows` and gives the hook's `list` to the table, so it keeps no ref of its
own. The section's Show more test fails when the table lacks that ref.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rker commands

Main gained two commits: the Review queue opens a pending proposal by its
address, and the `loom knowledge source worker-*` commands call the source
worker's setup operations. The first adds `memory_keys` and `actor` to the
proposal models, so the two generated wire-model files conflict:
sdk/go/wire/models.gen.go and sdk/rust/src/wire_models.rs. Each is written
again by its generator on the merged tree and holds main's proposal models
and the run.reliance models.

docs/features/dashboard.md, docs/guides/without-the-dashboard.md, the
Python, Ruby and TypeScript op tables, tests/analyzer/cases/planes.py and
tests/analyzer/shapes.txt merge on their own, each side in its own lines.

Every generator of an op and of a setting passes --check on the merged
tree, and the analyzer's shape list is current.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…records

Main gained two commits. Over MCP every receipted op is labelled with the
session's run, and a run opened there names that run in
`metadata.session_run`. Owner-only worker sources keep a private copy in
the mirror.

Four files conflict, and each keeps both sides:

- server/tasks/app/run.py imports the reliance states and the session run
  helpers.
- docs/features/runs.md: the paragraph on the receipts table names
  `run.reliance` and the session's reads of a run opened over MCP, and the
  Operations table holds main's `run.begin` row and the `run.reliance` row.
- docs/architecture/read-receipts.md lists the source entry points of both.
- sdk/go/wire/models.gen.go is written again by its generator.

The "An MCP session" row of "What is listed" in docs/features/runs.md said
that no answer gives an agent the id of its session's run. On main a run
opened with `run.begin` over MCP names it in `metadata.session_run`, which
`run.get` returns. The row now says that an MCP read is listed under the
session's run, that `run.reliance` reads the one id it is given and does
not follow that key, and that an agent calls it once for each id.

tests/analyzer/shapes.txt is written again on the merged tree. Besides
this branch's shape it replaces one shape of main's list: the knowledge
source access read selects `owner_subject`, and the list held the
statement without it.

Every generator of an op and of a setting passes --check on the merged
tree. tests/unit/test_degraded_unnoted.py fails on main and here for two
handlers of server/knowledge/app/source_access.py, which this merge does
not touch.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
zlareb1 and others added 2 commits December 5, 2026 01:16
Main gained one commit: `memory.proposals` names no contradicting memory
and counts no graded run outside the caller's read scope. It shares no
file with run.reliance, and the merge has no conflict.

Every generator of an op and of a setting passes --check on the merged
tree, and the analyzer's shape list is current.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… read gate

Main gained three commits: the prompt hook's risk label for a bug report's
first pick, the `make bench-revision` target, and the worker copy read
gate's broad handlers listed with the statement shapes regenerated. The
merge has no conflict.

Main's shape list now holds the knowledge source access read as this
branch's list did, so tests/analyzer/shapes.txt differs from main by the
shape of `run.reliance` alone. tests/unit/test_degraded_unnoted.py passes
on the merged tree.

docs/reference/configuration.md, loom.example.yaml,
server/settings/catalog.py and tests/unit/session_content_senders.json
merge on their own, each side in its own lines. Every generator of an op
and of a setting passes --check on the merged tree, and the analyzer's
shape list is current.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@zlareb1
zlareb1 merged commit a0a15e8 into main Dec 5, 2026
91 of 93 checks passed
@zlareb1
zlareb1 deleted the feat/reliance-report branch December 5, 2026 02:03
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