Repository navigation
Keep decisions an earlier Leaf recorded standing across a re-vendor - #2431
Merged
Merged
Conversation
A user's lf-options picks, and the Question they answered, stopped standing after `leaf page init` moved a page onto a newer layer. AGENTS.md says a later version keeps a user decision unless it explicitly retracts what the decision rests on. **Cause.** Each admitted action records its operation's definition in `meaning.state`, and `state_projection` folds an event only while `same_state_operation` finds the recorded definition equal to the one the current widget declares. That comparison required every key but `detail` to match exactly. #2329 renamed the recorded `update` flag to `report`, so every action admitted before it, on every page, carried a key the current definition lacked and silently stopped standing, with its Question reopened. The re-vendor only mattered because it let the new Python read the old log. **Fix.** - The operation is now the fields `state_definition` writes, `detail` aside, each required and equal. A field an earlier Leaf recorded beside them no longer retracts a decision; a missing or different field still does. Python (`registry/contract.py`) and the browser (`registry-contract.js`) hold the same rule. - The domain check that decides whether to re-validate a payload compares `detail` only, in `state_projection` and in the browser's pending-gesture check, so an undo of an older decision also draws at once. - The recorded definition no longer carries `report`: its only effect is the required `text` that `detail` already records. The event admission schema in `registry.json`, the generated `event-contract.d.ts`, the committed example and fixture logs, and `docs/event-log.html` follow. **Tests.** `test_a_decision_stands_when_an_earlier_leaf_recorded_its_operation` rewrites an admitted pick into the pre-#2329 form and checks that it stands and keeps its Question answered; it fails with the old comparison. Node tests cover `sameStateOperation` and a pending undo of such a decision. The affected page, copied to scratch, reads its revision-7 picks and answered Question again. > _This was written by Claude Code on behalf of max-sixty_ Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 11, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
…port: true` (#2645) The x-state flag that makes an agent verb's reports carry non-empty `detail.text` was called `report: true`. Every verb that can declare it already writes reports (`writer: "agent"`), so the name said nothing; `text: true` names what it requires. The rename covers the three Python readers (`registry/contract.py`'s detail schema, the report feed in `projection.py`, the excerpt in `history.py`), `schema.py`'s `STATE_SCHEMA`, the `ActionSpec` type, the references and `$` docs, `docs/registry.html` (regenerated with `leaf-dev keydocs`), the two registries that declared it (the command-hub example's `lf-atlas-worker` and the test fixture `lf-test-worker`), the corpus, and the `recorded-effect-payloads` eval rubric. Behavior change: `page check` now refuses a registry that declares `report: true` ("'report' was unexpected"). No shipped package declared it. The event log is unchanged, because since #2431 `state_definition` records neither name in `meaning.state`, so this needs no protocol bump; an older page whose own registry still says `report: true` is drift, fixed by re-vendoring or renaming the key. Two seeded test events carried a stale `"report": False` in `meaning.state` that admission no longer writes; it is removed. Touching `tests/journeys/test_render_gate.py` selected it, and it was already failing on main: since #2634, the options under an unsettled ask are joined cells with no transition, so its check that the arrival guard releases package transitions read `all` on `#wait-day`. It now reads the suggestion fold's `padding` transition instead. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 20, 2026
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 #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_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user's lf-options picks, and the Question they answered, stopped standing
after
leaf page initmoved a page onto a newer layer. AGENTS.md says a laterversion keeps a user decision unless it explicitly retracts what the decision
rests on.
Cause. Each admitted action records its operation's definition in
meaning.state, andstate_projectionfolds an event only whilesame_state_operationfinds the recorded definition equal to the one thecurrent widget declares. That comparison required every key but
detailtomatch exactly. #2329 renamed the recorded
updateflag toreport, so everyaction admitted before it, on every page, carried a key the current
definition lacked and silently stopped standing, with its Question reopened.
The re-vendor only mattered because it let the new Python read the old log.
Fix.
state_definitionwrites,detailaside,each required and equal. A field an earlier Leaf recorded beside them no
longer retracts a decision; a missing or different field still does.
Python (
registry/contract.py) and the browser (registry-contract.js)hold the same rule.
detailonly, instate_projectionand in the browser's pending-gesturecheck, so an undo of an older decision also draws at once.
report: its only effect is therequired
textthatdetailalready records. The event admission schemain
registry.json, the generatedevent-contract.d.ts, the committedexample and fixture logs, and
docs/event-log.htmlfollow.Tests.
test_a_decision_stands_when_an_earlier_leaf_recorded_its_operationrewrites an admitted pick into the pre-#2329 form and checks that it stands
and keeps its Question answered; it fails with the old comparison. Node tests
cover
sameStateOperationand a pending undo of such a decision. Theaffected page, copied to scratch, reads its revision-7 picks and answered
Question again.