Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
49040de
Preserve caller JSON in MCP results
yorkhellen Dec 3, 2026
a36a66c
Merge main into MCP payload fix
yorkhellen Dec 3, 2026
b28d5ee
Preserve task payloads in projected list replies
yorkhellen Dec 3, 2026
0c9cb88
Align version-byte tests with stored-value reads
yorkhellen Dec 3, 2026
f9a8822
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 3, 2026
40d0ef5
Preserve profile payloads and encode idempotent replies per transport
yorkhellen Dec 3, 2026
86d6f32
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 3, 2026
c549aeb
Keep MCP replay versions exact for older readers
yorkhellen Dec 3, 2026
6d3ae4b
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 4, 2026
ab20db2
Replay normalized results across HTTP replicas
yorkhellen Dec 4, 2026
cf32bc2
Normalize preceding MCP cache entries before lean shaping
yorkhellen Dec 4, 2026
ceaf98a
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 4, 2026
dd120d7
Memory read tokens survive rolling builds
yorkhellen Dec 4, 2026
e439f1f
Proposal approval requires the full content hash
yorkhellen Dec 4, 2026
8f86f55
Merge main and retain payload boundaries in degraded responses
yorkhellen Dec 4, 2026
5dd80e8
Merge main's MCP worker setup checks
yorkhellen Dec 4, 2026
4f4239b
Proposal reviews select their memory ID before limiting history
yorkhellen Dec 4, 2026
c9f9888
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 4, 2026
d5d2acb
Bulk reads and citations use point-read precondition tokens
yorkhellen Dec 4, 2026
b81ab4f
Merge upstream main into fix/mcp-user-payload
yorkhellen Dec 4, 2026
5f96482
Shared embedding repair preserves saved promotion content
yorkhellen Dec 4, 2026
34dd9d1
Merge upstream main into fix/mcp-user-payload
yorkhellen Dec 4, 2026
0905bfa
Mixed-version gates check the selected build's saved content
yorkhellen Dec 4, 2026
17b164e
Merge upstream main into fix/mcp-user-payload
yorkhellen Dec 4, 2026
0b61d77
Merge upstream main into fix/mcp-user-payload
yorkhellen Dec 4, 2026
32c1ce9
Proposal review scopes history to its identity
yorkhellen Dec 4, 2026
94c5f0b
Proposal review keeps full-content hashes with main changes
yorkhellen Dec 5, 2026
8162036
Proposal payload contracts include run reliance
yorkhellen Dec 5, 2026
f12911a
Merge main and repair verification hashes and review gates
yorkhellen Dec 5, 2026
45b7618
Merge main repository derivation updates
yorkhellen Dec 5, 2026
34b7f94
Prove generated Rust contract fixtures leave snapshot inputs unchanged
yorkhellen Dec 5, 2026
670aad7
Attestations and approvals bind full values; replay feedback names th…
yorkhellen Dec 5, 2026
49388f2
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 5, 2026
a4a11df
List attestations check complete previews and retries preserve receipts
yorkhellen Dec 5, 2026
5910d05
Merge main and isolate connected source unit fixtures
yorkhellen Dec 5, 2026
3575e78
The receipt gate replays writes through both builds
yorkhellen Dec 5, 2026
ec562d1
Stored JSON null binds read and verification hashes
yorkhellen Dec 5, 2026
024f558
Merge upstream/main into fix/mcp-user-payload
yorkhellen Dec 5, 2026
d90ef4e
Merge upstream/main into fix/mcp-user-payload
yorkhellen Dec 5, 2026
8eb1f9e
Memory lists preserve hydrated JSON string values
yorkhellen Dec 5, 2026
fa50499
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 5, 2026
63bd8e7
Merge remote-tracking branch 'upstream/main' into fix/mcp-user-payload
yorkhellen Dec 5, 2026
fffe171
Merge commit 'cdb93e8ddf900a73939c038d391242556e829828' into fix/mcp-…
yorkhellen Dec 5, 2026
533ee34
Regenerate code lead query shapes after main merge
yorkhellen Dec 5, 2026
7dbf946
Memory list checks truncated attestations against full content
yorkhellen Dec 5, 2026
415286c
Caller-shaped reads retain validation errors after retries
yorkhellen Dec 5, 2026
2800d41
Merge main with regenerated wire contracts
yorkhellen Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1429,9 +1429,20 @@ jobs:

mixed-version:
needs: [validate-ref, clickhouse]
name: builds N-1 and N on one ClickHouse
name: mixed-version (${{ matrix.scenario }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- scenario: previous build
base: HEAD~1
# v1.3.0 checks the analyst version before probing retired relations.
- scenario: published event views
base: 47b479dcdae4c089aef2690428fa4c9a8f54554c
- scenario: legacy shared copy
base: f189681c6b6c85f83737aa7da6a97c7880f9ad90
env:
LOOM_CLICKHOUSE_IMAGE: ${{ needs.clickhouse.outputs.image }}
steps:
Expand Down Expand Up @@ -1462,10 +1473,7 @@ jobs:
# first parent of its merge commit, the target branch as the merge was made. The
# target branch's tip can carry a newer migration by the time the run starts.
- name: Mixed-version gate
run: python scripts/gates/mixed_version.py --require --base HEAD~1
# v1.3.0 checks the analyst version before probing retired relations.
- name: Published build event-view compatibility
run: python scripts/gates/mixed_version.py --require --base 47b479dcdae4c089aef2690428fa4c9a8f54554c
run: python scripts/gates/mixed_version.py --require --base "${{ matrix.base }}"

sdk-rust:
needs: validate-ref
Expand Down
119 changes: 116 additions & 3 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
python3 - <<'PY'
import base64
import binascii
import hashlib
import http.client
import json
import os
Expand All @@ -44,6 +45,19 @@ jobs:
# The Compare API returns at most 300 files, even with commit pagination.
COMPARE_FILE_LIMIT = 300
MAX_COMPARE_BYTES = 8 * 1024 * 1024
MAX_TREE_ENTRIES = 30000
MAX_PROOF_COMMITS = 4
# Cargo metadata and the converter tests do not read these file contents.
GENERATED_SOURCES = {
"sdk/rust/src/wire_models.rs",
"sdk/rust/tests/registry_contracts.rs",
}
# These instruction links are outside Cargo and the converter's read set.
INSTRUCTION_LINKS = {
"loom-address-review", "loom-bench", "loom-change", "loom-debug",
"loom-deploy", "loom-dev-setup", "loom-file-issue", "loom-investigate-ci",
"loom-pre-push", "loom-release", "loom-review", "loom-ship-pr", "loom-writing",
}
SEVERITIES = {"low", "moderate", "high", "critical"}
SNAPSHOT_WORKFLOWS = {
".github/workflows/maven-dependency-graph.yml",
Expand Down Expand Up @@ -198,7 +212,94 @@ jobs:
return path.startswith(("sdk/rust/", ".github/scripts/"))


def check_snapshot_inputs(repository_url, base, head, token, opener):
def object_sha(value):
if not isinstance(value, str) or not re.fullmatch(r"[0-9a-f]{40}", value):
raise ReviewError("Invalid Git object identity for dependency snapshot proof")
return value


def parse_tree(data, tree_sha):
if (
not isinstance(data, dict)
or data.get("sha") != tree_sha
or data.get("truncated") is not False
or not isinstance(data.get("tree"), list)
or len(data["tree"]) > MAX_TREE_ENTRIES
):
raise ReviewError("Incomplete Git tree for dependency snapshot proof")
modes = {
"040000": "tree", "100644": "blob", "100755": "blob",
"120000": "blob", "160000": "commit",
}
entries = {}
for entry in data["tree"]:
if not isinstance(entry, dict):
raise ReviewError("Invalid Git tree entry")
path, mode = entry.get("path"), entry.get("mode")
if (
not isinstance(path, str) or not 0 < len(path) <= 4096
or any(part in {"", ".", ".."} for part in path.split("/"))
or any(ord(char) < 32 or ord(char) == 127 or char == "\\" for char in path)
or path in entries
or not isinstance(mode, str) or mode not in modes
or entry.get("type") != modes[mode]
):
raise ReviewError("Malformed or duplicate Git tree path")
object_sha(entry.get("sha"))
entries[path] = entry
for path in entries:
parent = path.rpartition("/")[0]
if parent and (parent not in entries or entries[parent]["mode"] != "040000"):
raise ReviewError("Missing or aliased Git tree ancestor")
return entries


def check_source_tree(entries):
for path in GENERATED_SOURCES:
candidate = entries.get(path)
if candidate is None or (candidate["mode"], candidate["type"]) != ("100644", "blob"):
raise ReviewError("Generated source is not an existing regular file")
for path, entry in entries.items():
if entry["mode"] not in {"120000", "160000"}:
continue
name = path.removeprefix(".agents/skills/")
if (
entry["mode"] == "120000" and name in INSTRUCTION_LINKS
and path == ".agents/skills/" + name
):
# Bind the exception to the exact instruction target, not just its name.
target = ("../../.claude/skills/" + name).encode()
blob = b"blob " + str(len(target)).encode() + b"\0" + target
if entry["sha"] == hashlib.sha1(blob, usedforsecurity=False).hexdigest():
continue
raise ReviewError("Cannot exclude a Git alias from dependency snapshot inputs")


def source_tree_proof(repository_url, commit, token, opener, cache):
object_sha(commit)
if commit in cache:
return
if len(cache) >= MAX_PROOF_COMMITS:
raise ReviewError("Dependency snapshot tree proof exceeds its commit limit")
data, _ = read_response(
opener, f"{repository_url}/git/commits/{commit}", token, MAX_COMPARE_BYTES
)
if (
not isinstance(data, dict) or data.get("sha") != commit
or not isinstance(data.get("tree"), dict)
):
raise ReviewError("Invalid commit for dependency snapshot tree proof")
tree_sha = object_sha(data["tree"].get("sha"))
data, _ = read_response(
opener, f"{repository_url}/git/trees/{tree_sha}?recursive=1", token, MAX_COMPARE_BYTES
)
check_source_tree(parse_tree(data, tree_sha))
cache[commit] = True


def check_snapshot_inputs(repository_url, base, head, token, opener, tree_cache=None):
if tree_cache is None:
tree_cache = {}
data, _ = read_response(
opener, f"{repository_url}/compare/{base}...{head}?per_page=1", token, MAX_COMPARE_BYTES
)
Expand All @@ -214,6 +315,13 @@ jobs:
if file["status"] == "renamed":
paths.append(file["previous_filename"])
if any(affects_snapshot(path, file) for path in paths):
if (
file["filename"] in GENERATED_SOURCES and file["status"] == "modified"
and "previous_filename" not in file
):
for commit in (merge_base, head):
source_tree_proof(repository_url, commit, token, opener, tree_cache)
continue
raise ReviewError("Dependency snapshots are incomplete and snapshot inputs changed")
return merge_base

Expand Down Expand Up @@ -259,6 +367,7 @@ jobs:
endpoint = repository_url + comparison
canonical_endpoint = f"https://api.github.com/repositories/{repository_id}{comparison}"
findings, blocked, total = [], 0, 0
tree_cache = {}
head_snapshot_missing = False
for page in range(1, MAX_PAGES + 1):
changes, link, missing = read_page(
Expand All @@ -277,9 +386,13 @@ jobs:
if not next_page(link, endpoint, canonical_endpoint, page):
result = {"changes": total, "blocked_advisories": blocked, "findings": findings}
if head_snapshot_missing:
merge_base = check_snapshot_inputs(repository_url, base, head, token, opener)
merge_base = check_snapshot_inputs(
repository_url, base, head, token, opener, tree_cache
)
if merge_base != base:
check_snapshot_inputs(repository_url, merge_base, base, token, opener)
check_snapshot_inputs(
repository_url, merge_base, base, token, opener, tree_cache
)
result["snapshot_inputs"] = "unchanged"
return result
raise ReviewError("Dependency changes exceed the page limit; review is incomplete")
Expand Down
52 changes: 49 additions & 3 deletions docs/architecture/memory-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,23 @@ outcome (refusal, 4xx `rejected`, or `error`) and to attach value-shape advisori
retention. A retention window that would move a `read_only` row's expiry is refused
(423, `refused_action` `expire`), as in `memory.bulk_set`.
6. **Proposals and preconditions.** `proposed=true` may not overwrite an established
fact (`_refuse_proposal_over_fact`). `if_match_sha256` must match the live hash (409
`PRECONDITION_FAILED`). `if_match_sha256='absent'` instead requires no unexpired
fact (`_refuse_proposal_over_fact`). `if_match_sha256` must match the live value's
canonical hash or the read's precondition token (409 `PRECONDITION_FAILED`).
`memory.get`, `memory.get_by_id` and `memory.bulk_get` return the full stored value,
but their `content_sha256` token hashes the native JSON projection when populated,
else the stored text. The projection can omit null and empty-object members, so
its token cannot detect changes limited to those members. Stored content hashes,
attestation checks and write responses cover the full value.
`memory.list` checks attestations against complete stored previews. For selected
attested rows whose stored preview is truncated, one scoped batch reads the full
value at the page's exact version and writer identity to compute its canonical hash.
High rows and projections omitting verification make no such read. Returned values
remain previews; missing full content cannot confirm an attestation, and the stored
digest cannot substitute for the canonical hash. The extra read has a 32 MiB aggregate
result ceiling, 256 MiB ClickHouse memory ceiling and caller-shaped work ceilings.
Exceeding a ceiling fails the request instead of marking unchanged content stale;
callers reduce the page limit. The preview cap does not bound internal decode memory.
`if_match_sha256='absent'` instead requires no unexpired
row at the exact identity and key; a concrete agent is required. It uses the strong
head already checked by the guards under the key's write lock. An expired physical
row stays attached to the write, so its locks and pin still hold and Postgres
Expand All @@ -93,7 +108,11 @@ outcome (refusal, 4xx `rejected`, or `error`) and to attach value-shape advisori
snapshots. The storage commit checks the locked current head before activating it or
clearing that bit. Only `memory.proposal_decide` can grant a permit for the exact
source and destination revisions, after an independent authenticated human
administrator supplies the hash of the content reviewed. Linked subjects count as
administrator supplies the full canonical hash of the content reviewed. The dashboard
reads the proposal's identity with `memory.get_by_id`, then scopes `memory.history`
to that identity and `memory_id` before the version limit. Both builds can read
the complete value and its hash from that revision; projected
read tokens cannot approve a different full value. Linked subjects count as
the same reviewer. Unknown proposer identity and failed alias reads refuse approval.
Automatic grading can reject or mark a proposal ready, but never accepts one.
7. **Build the version row** (`_set_build_memory_row`). Over a live row,
Expand Down Expand Up @@ -193,6 +212,33 @@ later real write still wins. A row that keeps failing accrues `embed_attempts` a
marked `embed_failed_at` so it cannot stall the batch. Every vector leg filters
`embedding_dim > 0`.

Shared stub recovery embeds the text saved in `loom.shared`, with the source key's
excerpt suffix. The copy must match either the complete source value or a populated
native object actually present on its authority head. Recovery enumerates every identity
the promotion's lineage may name before checking approval and sensitivity; multiple
matching heads refuse recovery. It carries the shared row and every candidate head,
including missing candidates, from before the provider call into publication admission.
Admission checks both the complete value and the saved copy against refusal policy for
every possible source user. A policy read failure withholds the provider call.
The preflight releases its fences before that call; a concurrent refusal can still arrive
before the send, and the final admission prevents publication of the refused vector.

The copy's hash, excerpt and vector describe the saved content. Verification requires a
current attestation of the complete source and a copy with the same complete-value hash.
Lineage records an identity and key, without the source version or complete-value hash
at promotion time. Recovery cannot detect a change confined to fields its saved native
projection omitted, or prove a unique historical source from one matching current head.
It publishes no omitted fields and transfers no attestation to a different copy.

Promotion, shared recovery and demotion acquire one target lease for
`(org, namespace, memory_key)` across embedding models before source and consent fences.
A definition's namespace claim precedes that lease. Demotion holds it through vector
enumeration and canonical retirement; publication and retirement retain it while a send's
outcome is unknown. Postgres admission locks every candidate's user scope before checking
source heads, so an absent ambiguous candidate cannot be inserted during publication.
The target lease serializes builds that acquire it. A rolling build that does not acquire
that lease retains its concurrency boundary even when its saved stub can be recovered.

## The conflict resolver

A cosine hit says two rows are about the same thing, not whether one replaces the other.
Expand Down
18 changes: 16 additions & 2 deletions docs/architecture/rolling-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ See the [participant lifecycle baseline](cells.md#participant-lifecycle-baseline
field. A build without this meaning refuses it as a hash mismatch, including on a
missing key, instead of storing an unconditional write. First creation may therefore
answer 409 while such a build serves; clients must not retry without the condition.
Ordinary content hashes still work across builds, and rollback needs no data change.
Read precondition tokens work across builds, and rollback needs no data change.
N returns the full stored JSON value; N-1 can omit null and empty-object members.
Both builds accept the read's `content_sha256`, which hashes the native JSON
projection when populated, else the stored text. This token cannot distinguish
changes limited to omitted members. N also accepts the full content hash a write
returns; N-1 can reject that hash when its projection differs. Clients writing
across builds use the token from a read. Attestation hashes cover the full value.
13. **A name N spells differently is a different node.** N keeps combining marks and
NFKC-normalises an entity's name (`दिल्ली`, `İstanbul` as `istanbul`); N-1 split them
into fragments (`द ल ल`, `i stanbul`). ASCII names spell the same in both, and so do
Expand Down Expand Up @@ -1387,6 +1393,14 @@ bit or treat a passing grade as approval. Consolidation excludes pending sources
Legacy rejected native rows and snapshots without the review field conservatively require
review; an explicit false field on an ordinary rejected fact preserves its correction path.

Clients accepting proposals must send `approved_sha256` for each key and use an
Clients accepting proposals must send the full canonical content hash from
`memory.history` as `approved_sha256` for each key and use an
authenticated human administrator independent of the proposer. Automatic policies continue
to reject failed proposals and leave passing proposals pending human review.

The dashboard reads the proposal's full identity by id before reading its history;
this also scopes a history read on a build that ignores the `memory_id` filter.
Either build can supply the complete reviewed value and hash. Approval writes must
reach an upgraded server: a server that compares the native JSON projection rejects
a full hash when null or empty-object members were omitted. Sending its projected
hash would allow an omitted-member replacement to pass review.
9 changes: 9 additions & 0 deletions docs/architecture/system-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ A write op refuses a close match with 422
`UNKNOWN_ARGUMENT`. Identity keys and keys the transport reads itself (`consumer`,
`traffic_class`, `explain`, the idempotency key) are never reported.

The idempotency row stores the first answer with its argument feedback, normalized
for HTTP; MCP writers also encode server version integers as strings for readers
that replay without integer conversion. `server/transport/idempotency_receipt.py`
records handler-owned `ignored_args` in the row's `response_headers`. Current
readers retain those names and derive argument feedback from the retry. A preceding
HTTP reader returns the stored receipt unchanged. An unmarked receipt has no
ownership record, so its names are retained; feedback from a preceding HTTP writer
cannot be separated from handler feedback.

**After the handler.** The ledger row carries latency and the embedding and LLM spend of
the call. The budget-violation row (over `budget_p99_ms` × `LOOM_LATENCY_BUDGET_MULTIPLIER`),
the audit row (when `op.audit`) and the idempotency row go in one round trip
Expand Down
Loading
Loading