Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 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
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 @@ -1427,9 +1427,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 @@ -1460,10 +1471,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
43 changes: 40 additions & 3 deletions docs/architecture/memory-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ 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.
`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 +99,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 @@ -190,6 +200,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 @@ -192,7 +192,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 @@ -1307,6 +1313,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.
1 change: 1 addition & 0 deletions docs/reference/operations/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ Enumerate the version history of one memory_key.
| `session_id` | `str` | `'-'` | The session or conversation the row belongs to; `'-'` for none. |
| `run_id` | `str` | `'-'` | The agent run (task scope) the call belongs to; `'-'` for none. |
| `memory_key` | `str` | required | The key whose versions are listed. |
| `memory_id` | `str` | `''` | Limit the key's history to this memory UUID; empty lists every matching identity. |
| `limit` | `int` | `50` | At most this many versions, newest first. |

| Output field | Type | Meaning |
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,9 @@ export async function getMemory(
* or the caller cannot read its namespace. */
export interface MemoryById {
found: boolean;
agent?: string;
user_id?: string;
session_id?: string;
content_sha256?: string;
memory_id: string;
namespace: string;
Expand Down
31 changes: 31 additions & 0 deletions frontend/src/api/admin.history.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { afterEach, describe, expect, it, vi } from "vitest";

const post = vi.hoisted(() => vi.fn(async () => ({ rows: [] })));
vi.mock("../api", async (importOriginal) => ({ ...(await importOriginal<typeof import("../api")>()), post }));
import { memoryHistory } from "./admin";

const id = { org: "acme", namespace: "team", agent: "*" };

afterEach(() => vi.clearAllMocks());

describe("memory history", () => {
it("sends the proposal ID with the key and limit", async () => {
const memoryId = "00000000-0000-0000-0000-000000000001";
await memoryHistory(id, "candidate", 1, memoryId);
expect(post).toHaveBeenCalledWith("/v1/memory.history", {
...id,
memory_key: "candidate",
memory_id: memoryId,
limit: 1,
});
});

it("keeps a key-wide history request when no ID is supplied", async () => {
await memoryHistory(id, "candidate");
expect(post).toHaveBeenCalledWith("/v1/memory.history", {
...id,
memory_key: "candidate",
limit: 10,
});
});
});
8 changes: 7 additions & 1 deletion frontend/src/api/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,14 @@ export async function memoryHistory(
id: Identity,
memoryKey: string,
limit: number = 10,
memoryId: string = "",
): Promise<{ rows: MemoryHistoryEntry[] }> {
return post("/v1/memory.history", { ...id, memory_key: memoryKey, limit });
return post("/v1/memory.history", {
...id,
memory_key: memoryKey,
limit,
...(memoryId ? { memory_id: memoryId } : {}),
});
}

export interface RelatedMemoryRow {
Expand Down
Loading
Loading