Skip to content

Hold Leaf's boundary records to what current code writes - #3197

Merged
max-sixty merged 3 commits into
mainfrom
agent-aa11ef527ed9d9ea7
Oct 20, 2026
Merged

max-sixty merged 3 commits into
mainfrom
agent-aa11ef527ed9d9ea7

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

An audit of Leaf's boundary data structures found five places where code and records disagreed. This change fixes each one.

Reads of records only an older Leaf wrote are deleted (root AGENTS.md, "Stage"):

  • data.read_source reads a value file as a publication. A file holding a bare value now fails like any other malformed file instead of reading as that source's error.
  • registry.storage.layer_metadata requires $layer.server. A layer without it is refused as layer-identity, whose message names the re-vendor.
  • thread.is_answer no longer excludes progress addressed to an input. Only logs from before Fold ephemeral thread updates when an answer arrives #1727 held that, and the kernel schema refuses an ephemeral reply with responds.
  • events.build_threads reads a reply's thread directly. Admission keeps every reply's parent in force, so the branch that skipped a reply to a withdrawn message read only logs from before that rule.

The tests that built those old records are deleted. A data test that rewrites a value file now writes an invalid value inside a publication.

GET /api/user-view is deleted, along with the page sources' user_views() and the leaf.page snapshot's saved copy of the route. The browser's POST stays. The feature gallery's "Read observed views" button was the route's one caller. Its section now says that the agent reads the observations under user_views in leaf page state, and the corpus is regenerated.

$state and $awaits now document every field their schemas admit. $state gains detail, writer and text, and $awaits gains retired, reply and encloses, each with a description. The check that held $keys to EXTENSION_SCHEMA now holds all three facts to their schemas (registry.layer.DOCUMENTED_KEYS: EXTENSION_SCHEMA, VERB_SCHEMA, AWAITS_SCHEMA), and the keys-documentation finding names the fact. test_the_field_docs_hold_to_the_fields_their_schema_admits covers it.

event-batches.md now describes the envelope delivery.py writes: was and suggestion on an event that rewrites a user's message, the correction that a refused answer's retry carries, and the paged reading (part, parts, text, next, and acknowledge on the last part).

The state home now stays owner-only. state.state_home replaces both state_home_path and machine.state_home, so every path into the state home goes through it. It creates the home with mode 0700 and resets an existing home to 0700. server.host_key keeps access.json at 0600 even when the file already existed. Both write the mode only when it differs, so a sandboxed command that can only read still resolves its paths. test_the_state_home_and_its_key_stay_owner_only covers both, and fails with either reset removed.

Two older-Leaf reads remain on purpose. server.read_service and the stop path in hosting handle a service.json that another installed Leaf wrote, which can happen while that Leaf's server is still running. registry.contract.same_state_operation keeps a user's decision through a re-vendor (#2431).

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 3 commits October 19, 2026 17:15
Reads of records only an older Leaf wrote are gone (root AGENTS.md, "Stage"):

- `data.read_source` reads a value file as a publication. A file holding a
  bare value now fails like any malformed file instead of reading as that
  source's error. Its test is deleted.
- `layer_metadata` requires `$layer.server`; a layer without it is refused as
  `layer-identity`, which names the re-vendor.
- `thread.is_answer` no longer excludes progress addressed to an input, which
  only logs before #1727 held; the kernel schema refuses an ephemeral reply
  with `responds`. Its case in `test_success_readers_require_the_same_exact_agent_answer`
  is dropped.

`GET /api/user-view` is gone, with the page sources' `user_views()` and the
leaf.page snapshot's saved copy of it; nothing requested it. The browser's POST
stays.

`$state` and `$awaits` in the kernel registry now document every field
`VERB_SCHEMA` and `AWAITS_SCHEMA` admit (`detail`, `writer`, `text`;
`retired`, `reply`, `encloses`), each with a description. The `$keys` check
generalizes to all three facts (`registry.layer.DOCUMENTED_KEYS`), and the
`keys-documentation` finding names the fact.
`test_the_field_docs_hold_to_the_fields_their_schema_admits` holds it.

`event-batches.md` describes the envelope `delivery.py` writes: each event's
`was` and `suggestion` on a rewritten message, the `correction` a refused
answer's retry carries, and the paged reading's `part`, `parts`, `text`, `next`
and last-part `acknowledge`.

The state home's owner-only mode now holds. `state.state_home` is the one
function every state-home path resolves through (`state_home_path` and
`machine.state_home` are gone); it creates the home 0700 and returns an
existing home to 0700. `server.host_key` holds `access.json` at 0600 even
when the file already existed. Both write the mode only when it differs, so a
sandboxed reader can still resolve paths. `test_the_state_home_and_its_key_stay_owner_only`
holds both.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The feature gallery's "Read observed views" button was the one caller of
`GET /api/user-view`. Its section now says where the agent reads the
observations (`user_views` in `leaf page state`), and the corpus is
regenerated.

`build_threads` reads a reply's thread directly. Admission keeps every
reply's parent in force, so the branch that skipped a reply whose parent was
withdrawn read only logs from before that rule; the admission test no longer
writes such a log.

The data test that rewrites a value file now writes an invalid value inside a
publication, since a bare value is no longer a file any writer produces.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 54f8467 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-aa11ef527ed9d9ea7 branch October 20, 2026 00:36
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.

2 participants