Skip to content

Refuse to serve a page whose runtime came from another Leaf - #1211

Merged
max-sixty merged 1 commit into
mainfrom
refuse-foreign-runtime
Sep 26, 2026
Merged

max-sixty merged 1 commit into
mainfrom
refuse-foreign-runtime

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A page's server is whatever Leaf ran the start, while its browser runtime is whatever the last leaf page init copied in, and nothing compared the two. After #1193 renamed conversation to thread, a post-rename server serving a pre-rename page left the page throwing read failed: can't access property "threads", state.browser.conversation is undefined on every state read. The page stayed up while it was broken.

Now every one-page server refuses such a page and names the fix:

<page> was vendored from another Leaf's runtime: its layer names sha256:…, and this Leaf (<path>) ships sha256:…. Leaf serves and checks a page only against the runtime it ships, so re-vendor it with `leaf page init <page>`.

Where it lives

  • layer.foreign_runtime(page_dir, layer) is the one comparison of the page's recorded $layer.runtime with this Leaf's payload_runtime_fingerprint(). It replaces the render gate's _refuse_a_foreign_runtime.
  • http.page_endpoint calls it, and every one-page server is built through it: server start, server run, server run --temporary, a revival by leaf wait, a --user preview's restart, and the render gate's own server.
  • cmd_serve now builds the endpoint before it takes the server lease or writes service.json, so a refused start writes nothing and gives the claim back. A server that is already running is still reused.

What changes for agents

  • After a plugin update: an older page stays down until it is re-vendored. leaf wait's revival is refused and prints the leaf page init message.
  • In a checkout whose runtime JS was edited: pages vendored before the edit refuse to start until they are re-vendored. Previews re-vendor on every runtime edit anyway.
  • Limits: the fingerprint covers only assets/runtime/, so a contract change made only in Python passes it. layer-registry.md says so. The MCP App's ProcessPageServer isn't built through page_endpoint and doesn't check the runtime. Its stale side is usually the long-running leaf mcp process rather than the page, so leaf page init would be the wrong advice there. layer-registry.md records that gap too.

Tests

  • A refused server start exits non-zero, names both runtime ids and leaf page init, and takes no claim, writes no service.json and holds no lease. After page init the start succeeds.
  • A wait doesn't revive a dead enabled service over a mismatched page, and it prints the leaf page init message.
  • Both tests fail on main.

Results: the everyday suite passes, as do the nightly session, server, layer, export and gate files and npm run test:runtime. Pre-commit is clean.

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

🤖 Generated with Claude Code

A page's server is whichever Leaf starts it, while its browser runtime is
whatever the last `page init` vendored. Nothing compared the two outside
the render gate, so after a contract change (#1193's `conversation` →
`thread`) a newer server left an older page throwing on every state read.

`layer.foreign_runtime` is now the one comparison of the page's
`$layer.runtime` with this payload's runtime fingerprint, and
`http.page_endpoint` refuses on it, naming `leaf page init <page>`. Every
one-page server binds through that function: `server start`, `server
run` (including `--temporary`), a `leaf wait` revival, and the render
gate's ephemeral server, whose private check it replaces. `cmd_serve`
builds the endpoint before taking the lease or writing `service.json`,
so a refused start leaves the service as it found it and `starting_claim`
gives the claim back. A refused revival prints the refusal and the page
reads as lost.

The fingerprint still covers `assets/runtime/` alone; layer-registry.md
now says what passes it.

Tests: a refused `server start` takes no claim, writes no service, and
succeeds after `page init`; a wait does not revive a dead server over a
mismatched page and prints the re-vendor.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 16a6b88 into main Sep 26, 2026
5 checks passed
@max-sixty
max-sixty deleted the refuse-foreign-runtime branch September 26, 2026 15:37
max-sixty added a commit that referenced this pull request Nov 20, 2026
The sentence in authoring-on-me.md's "Make each question self-contained" told
the agent to name work by what it does "rather than by its number". Max wants
the number kept, since it is how the user finds the pull request, with words
beside it that say what the work is. The sentence now asks for that, with
"Merging #431, the retry for dropped uploads" as its title example, and moves
to the end of the paragraph, after what a question mainly holds, since he still
found it prefatory where it stood.

The naming rubrics now let an option cite a number its ask's title describes,
as "Merge #812" under "Merging #812, the LRU result cache", since the card
gives the number its context.

Evals (Claude Code, this tree, 3 runs a case): fork asks name the work 6/6,
items-right 27/27, guardrails 9/9. The agent's merge ask after a compaction
titles every thread with both, as "Merging #1211, the badge on notes waiting to
sync", but in each run still mentions #1204 in passing without saying what it
is, so names scores 0/3. The page-sections case names 1/3. A version whose
example was a passing mention ("#431, the retry for dropped uploads", not a
bare "#431") raised sections to 2/3 but titled merge asks "Merging #1211"
in 3/3, so the title example stays. About $14 of runs.
max-sixty added a commit that referenced this pull request Nov 20, 2026
…6560)

Agents on Leaf pages ask the user to decide about work they name only by
number: thread titles "Merging #6551", options "Merge #6551", passing
mentions such as "It doesn't depend on #6538". The user meets each ask
on its own in On Me or Threads, often hours later, and can't tell what
it is about. Of 43 merge asks on this machine's pages since 5 Nov, 17
were titled by number alone, and the turn-end check's fork wrote 31 of
the 43. This adds one sentence to the end of `authoring-on-me.md`'s
"Make each question self-contained": beside each pull request, issue or
commit a question mentions, say what that work is, with "Merging #431,
the retry for dropped uploads" as the title example. Every writer of an
ask reads that paragraph, the fork included through `clerk.GUIDANCE`. It
also adds a `names` rubric to the evals that score asks, which lets an
option cite a number its ask's title describes.

To weigh: passing mentions still slip. The agent's merge ask after a
compaction titles every thread well but mentions #1204 without saying
what it is in 3/3 runs, and page sections name their PRs 1/3. A version
whose example was a passing mention raised sections to 2/3 but brought
back bare "Merging #1211" titles, so the title example stays.

Requested by the maintainer, who rejected earlier versions that put the
rule in `SKILL.md`'s "Must remember" and that dropped the number; he
hasn't read this diff. Evals (Claude Code, 3 runs a case): fork asks
name the work 6/6 (main 0/6), items-right 27/27, guardrails 9/9. Tests:
`test_clerk.py`, `dev/tests/test_evals.py`.

> _This was written by Claude Code on behalf of max-sixty_
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