Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions docs/architecture/rolling-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,21 @@ See the [participant lifecycle baseline](cells.md#participant-lifecycle-baseline
`tests/unit/test_stewardship_assign.py` checks the gate; the mixed-version gate does
not.

88. **An unknown key inside `memory.apply`'s `target` or an action block** (no
migration): N refuses it at validation with 422 `VALIDATION_FAILED` naming the
key's path, and the call does not run
([unknown and removed fields](../reference/http-api.md#unknown-and-removed-fields)).
N-1 drops the key and runs the call on what is left: a filter that lost a predicate
selects more rows than the caller wrote, and a block that lost a key acts on its
defaults. While both builds serve, the same call is refused by one replica and run
by another, so a client sends only the documented keys of `target`,
`target.filter`, `target.search`, `expire`, `lock`, `label` and `demote`. Rule 12
does not hold inside these objects: a field a later build adds to one of them is
refused by the build before, not ignored. A field removed from one of them is
refused from then on, not served and named in `ignored_args`. No gate holds the
rollout, and a rollback leaves nothing behind. `tests/unit/test_memory_apply.py`
checks N's side, and the mixed-version gate does not check this rule.

## What checks them

`scripts/gates/mixed_version.py` (`make test-mixed-version`, the `mixed-version` CI job,
Expand Down
6 changes: 4 additions & 2 deletions docs/architecture/system-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ Why this order:
controls. When either raises, the call is admitted and the failure is counted and logged
at most once a minute (`gates._fail_open`). Authentication and authorization fail closed.

**Unknown arguments.** Input models ignore unknown keys, so `server/transport/arg_check.py`
**Unknown arguments.** Input models ignore unknown top-level keys, so `server/transport/arg_check.py`
names them: the response carries `ignored_args` (and `did_you_mean` for a close field
name), and HTTP sets `X-Loom-Ignored-Args`. Both list first any field the op read but
declined to apply, then the unread keys. HTTP percent-encodes each UTF-8 name before
joining the header components with commas; the JSON names stay unchanged.
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.
`traffic_class`, `explain`, the idempotency key) are never reported. The nested objects
of `memory.apply` refuse an unknown key at validation instead (422 `VALIDATION_FAILED`
naming its path), so a misspelt predicate cannot widen a filter.

**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`),
Expand Down
2 changes: 1 addition & 1 deletion docs/features/memory/writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ key then answers `conflict_verdict: "conflict"`, `peers[0].memory_key:
| `memory.delete` | Writes a tombstone, looking past the caller's identity for the key (`found=false` when no live row exists). `memory.delete_version` instead reads only the caller's exact identity (a concrete agent) and, under the key's write lock, deletes only the version it names, else `tombstoned=false, reason="version_changed"`. Consolidated summaries lose the row: retired when no source survives, else `conflicted`. Permanent refusal blocks restoration and later intake of the removed content. |
| `memory.move` | Renames a key, carrying value, type, tags, entities, validity and provenance. The source becomes a redirect (`canonical_key`, `follow=true`) or, with `keep_redirect=false`, a tombstone. See [optimize a namespace](../../guides/optimize-namespace.md). |
| `memory.lock` | `read_only` refuses value, expiry and deletion changes; `no_delete` refuses tombstone, redact, clear and consolidation. Both refuse `memory.reject` (423 `LOCKED`); a negative-outcome quarantine leaves a locked row as it is, while its negatives keep counting. A writer may lock or tighten (`until`, `ttl_seconds`); `memory.unlock` is admin. `locked=false, reason="not_found"` is not a lock. |
| `memory.apply` | A `target` (keys, a filter or a search; filter and search need `limit` ≤ 1,000), an `action` (`delete`, `expire`, `lock`, `label`, `demote`), a `reason`, `dry_run` on by default. Each row goes through the single-row path; refusals come back as `refused` rows. Refuses `agent="*"`. |
| `memory.apply` | A `target` (keys, a filter or a search; filter and search need `limit` ≤ 1,000), an `action` (`delete`, `expire`, `lock`, `label`, `demote`), a `reason`, `dry_run` on by default. Each row goes through the single-row path; refusals come back as `refused` rows. Refuses `agent="*"`, and an unknown key inside `target` or an action block with 422 `VALIDATION_FAILED` naming its path ([unknown fields](../../reference/http-api.md#unknown-and-removed-fields)). |

## Provenance fields

Expand Down
15 changes: 12 additions & 3 deletions docs/reference/http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ policy exposes when `LOOM_CORS_ORIGINS` is set: `X-Request-Id`,

## Unknown and removed fields

Input models ignore keys they have no field for, so Loom names them instead of
dropping them silently (`server/transport/arg_check.py`):
An op's input model ignores a top-level key it has no field for, so Loom names
the key instead of dropping it silently (`server/transport/arg_check.py`):

- A successful response carries `ignored_args` (the top-level keys the op did
not apply) and, when one is a near miss for a real field, `did_you_mean`
Expand All @@ -282,8 +282,17 @@ dropping them silently (`server/transport/arg_check.py`):
is audited or records state: any op the catalogue does not mark read-only)
refuses a near-miss key with `422 UNKNOWN_ARGUMENT` and writes nothing: the
write it would have made is not the one asked for.
- The nested objects of `memory.apply` (`target`, `target.filter`,
`target.search` and the `expire`, `lock`, `label` and `demote` blocks) refuse
a key they have no field for with `422 VALIDATION_FAILED`: a filter the
caller did not write must not select rows. The key's entry in
`detail.errors` has the type `extra_forbidden` and the key's path as `loc`
(`["target", "filter", "tag_any"]`). The call is refused before it runs, with
`dry_run` on or off. Over MCP the refusal also names the field a near miss
most likely meant ([MCP errors](./mcp.md#errors)).
- A field removed from the wire is treated as unknown: served, and named in
`ignored_args`, so an older client keeps running without the feature.
`ignored_args`, so an older client keeps running without the feature. A field
removed from one of `memory.apply`'s nested objects is refused instead.
- An op may report a field it reads but did not apply. That field is listed
first in `ignored_args` and in the header, before the unread keys.
`memory.set_from_messages` does this for `agent_learnings=true` while
Expand Down
Loading