Repository navigation
Let a page an earlier Leaf vendored be read and re-vendored again - #822
Conversation
A plugin update swaps the running Leaf under a standing page, and #820 found that the page could then be neither used nor repaired. `$events.kinds` is Leaf's fixed kernel transport contract. A page's vendored `registry.json` holds the one the Leaf that wrote it had, so after an update it cannot equal the running kernel's, and `load_registry` refused every read of the page with a contract the reader had no way to meet. Re-vendoring is the only move that resolves it, so the refusal now names `leaf page init` — the shape `layer_metadata` already uses for a registry missing its `$layer.generation`. `page init` then has to take that move, and it refused too. `candidate_vocabulary_gaps` was checking each logged event against the incoming per-kind `record` schema, which is a gap a layer selection can never own: the kinds are fixed per version, so no selection restores the shape an earlier Leaf wrote a log in, and admission is the only reader of that schema — an event already in the log replays identically whichever layer is vendored over it. The guard keeps what a selection does own: a dropped reaction token, a retired verb, a kind the contract no longer declares. The complete stored record now has no validator at all; the browser door checks the client's half of it and the CLI writers check none, so restoring that belongs at the append boundary rather than here. `test_init_refuses_a_historical_event_record_outside_its_declared_schema` held the refusal and moved with it: it now asserts the re-vendor runs and that the event still replays afterwards. The new case in test_interact_layer.py runs the reported journey — a log and a vendored layer spelling the agent's role with the token #811 renamed, a refused `version check` that names the way out, a `page init` that takes it, and the same reply reading back through `leaf transcript`. Closes #820
b4dc0d6 to
44d5980
Compare
|
Let's not muddy our guidance etc: we should have good error messages, but they can be generic and suggest upgrading leaf We don't want to spend any of our instruction budget or code complexity budget on backward-compat |
The reference paragraph spent instruction budget explaining a state an install update leaves behind; the refusal itself already names the move, so the paragraph carried nothing an agent needed at the moment it reads the error. The docstrings behind it shrink to the rule each boundary holds.
|
Trimmed to that in 648a44e. The Worth saying that neither half of the code change is backward-compat handling. Nothing reads the old shape — the PR deletes the per-kind |
Three changes from a survey session: one code fix found by hitting it, and the list and note edits that follow from the survey's own results. Item numbers below are `TODO.md` ids, written without a hash so they do not read as issue references. ## A claim this version cannot read is dropped, not raised on The claims directory is one per machine and every worktree, host and session on it writes there, each running the leaf it was built from — so a record older than the code reading it is ordinary rather than exceptional. #813 removed the last shim on the premise that "every claim is written by the running version", which a shared state home makes false. Found by hitting it an hour ago: a session held six preview pages claimed before #811 named a harness, merged a main that had landed it, and every `leaf wait` afterwards died in `owned_by` on `claim["harness"]` — taking the watcher off the unrelated page the reader was on. The page's own loop guard then fired on every turn, and nothing in the message said why. This is the third refusal in the family #822 named an hour earlier, from the same cause: an update swaps the running Leaf under standing state. #822 fixed the registry read and the re-vendor; the claim read was still crashing. Stage still owes nothing to what an older version wrote, so nothing here migrates a record or reads its old shape. `readable_claim` is one predicate on the two file readers every other reader goes through: a record the readings above can take their answers from is a claim, and any other record is not one this version can read, so its page reads as unclaimed until something claims it again. That is what deleting the stale state would have done, without the deletion, and no session is taken down by state it does not own. The harness *name* is decided at that same door, which review caught: `host.claim_harness` does `HARNESSES[claim["harness"]]`, so carrying the field was not enough — a record naming a harness outside this version's table passed the predicate and raised two calls further in, in the Stop hook and in the nudge the append door takes under its lock. Renaming a harness is reachable by exactly the mechanism that made the field rename reachable. `turn_closed` joins the field set for the same reason: `event_endpoint` brackets it, and it was covered only by the accident that it predates `turn` in the schema. `CLAUDE.md`'s Stage section gains the missing half of its own rule — it said stale state is thrown away without saying who throws it. ### Verification `test_a_claim_an_older_leaf_wrote_is_dropped_rather_than_read_or_raised_on` runs the reported journey: two pages held by one session, the first claimed in the shape written before #811, and `leaf wait` on the second. Bug-back with `readable_claim` removed reproduces the exact production error, `KeyError('harness')` out of `leaf wait`, rather than a weaker assertion failure — which needed the stale page to sort ahead of the reader's page in the watcher's walk, as it did in the wild. The two review cases go through the Stop hook, which is where their consequence is. Bug-back on the harness-name guard raises `KeyError('some-host-a-later-leaf-named')` out of the hook; bug-back on `turn_closed` has the hook name a page nothing owns, which is the flood this PR is fixing rather than a raise. Everyday suite green on the merged head: 1,172 passed. ## `TODO.md`: item 25 retired, items 5 and 7 re-measured Item 25 asked for one App Server client instead of two. #811, #813 and #834 dissolved what it named: `codex.py` exports `app_server_connect`, `app_server_handshake` and `app_server_request`, both callers use them, `AppServerClient` moved out to `codex_adapter.py`, and `worker/server.py` imports 17 public names and no private one. The reconnect backoff, written four ways when the item was raised, is written once. What survived it is two turn supervisors over that one protocol — `HostedTurn` and `WebsiteCodexHost` in `worker/server.py` at about 900 lines, against `TaskObserver` and `DeliveryTurn` in `codex_adapter.py` at about 1,000. They supervise different things, a local Codex process with a queue and a lease against a hosted per-reader container turn, so merging them is a restructure with no deletion. That is item 6's question, under the product condition item 6 already carries, so item 25 retires and item 6 states what is left of it. Items 5 and 7 carried figures from before #808, #815 and #797 landed; both are re-measured against `main` at `76252900` and dated. ## `notes/dependency-survey.md` One line pointed at a `TODO.md` item `b7e1efd0` had already removed. It now points at the work that landed. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
A plugin update swaps the running Leaf under a standing page. #820 reports what that leaves: a live page that cannot be validated, replied to, or re-vendored, with readers still commenting on threads nobody can answer. Two refusals produced that, and this removes both.
$events.kindsis Leaf's fixed kernel transport contract, and a page's vendoredregistry.jsonholds the one the Leaf that wrote it had. After an update the two cannot be equal, soload_registryrefused every read of the page —version check,version stamp,reply— with a contract the reader had no way to meet. Re-vendoring is the only move that resolves it, so the refusal gains a one-line hint namingleaf page init, the shapelayer_metadataalready uses for a registry missing its$layer.generation.page initthen has to take that move, and it refused too.candidate_vocabulary_gapswas checking each logged event against the incoming per-kindrecordschema, which is a gap a layer selection can never own: admission is the only reader of that schema, and an event already in the log replays identically whichever layer is vendored over it. That check is deleted rather than relaxed. The guard keeps what a selection does own: a dropped reaction token, a retired verb, a kind the contract no longer declares.No shim reads the old shape and no guidance explains one — the page's vocabulary is regenerated, and the refusal says so where the reader meets it. Re-vendoring does not undo what the update itself changed: #813 dropped the shim reading the old
claudeauthor token asagent, so the reported page's 13 replies read as user turns under the running Leaf, before and after the re-vendor alike. That was a deliberate call under Stage, and this PR leaves it there.Verification
The new case in
tests/test_interact_layer.pyruns the reported journey against a page whose log and vendored layer spell the agent's role with the token #811 renamed:version checkrefuses and names the way out,page inittakes it, the vendored kinds come back equal to the kernel's,version checkpasses, and the standing reply reads back throughleaf transcript. Before this change it fails at the refusal, with the issue's two messages verbatim.test_init_refuses_a_historical_event_record_outside_its_declared_schemaheld the removed refusal and moved with it — it now asserts the re-vendor runs and that the event still replays afterwards, next to the sibling cases that pin the selection-owned gaps.tests/test_interact_layer.py,test_interact_contract.py,test_interact_server.pyandtest_interact_document.pypass together: 705 passed, withtest_staged_writes_honor_umask_without_copying_a_replaced_symlink_modefailing identically on an unmodified checkout of its merge base in the same sandbox.One boundary this deliberately leaves open
Removing the record check leaves the complete stored record with no validator. The browser door validates with
browser=True, which dropsmeaningandgeneratedfromrequiredand strips the fields the server stamps afterwards, so it only ever sees the client's half;append_event, which the CLI writers use, validates nothing.page initwas the one place the full record was checked, several commands after the write, with an unremediable refusal as its only response — which is what this PR removes. Restoring the invariant belongs at the append boundary, where a violation is still the writer's to fix, and that is a change of its own.Closes #820 — automated triage