Repository navigation
Serve passive website sessions from the edge - #427
Merged
Merged
Conversation
leaf-agent
reviewed
Sep 8, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
Two inline fixes below. Separately, one reference is now out of step with the code, in a file the diff doesn't touch:
skills/leaf/references/internals/layer-registry.md states of the bootstrap supervisor: "After a startup failure it reloads only when the server incarnation or layer generation changes." bootstrap.js now reloads on two further conditions — a Leaf-Release mismatch, and a 404 from the probe whenever the document declares a release. That reference owns the reload contract, and per CLAUDE.md's "Before finishing a feature" it should move with the implementation. Happy to push that amendment if you'd like it in this PR.
leaf-agent
approved these changes
Sep 8, 2026
This was referenced Sep 8, 2026
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.
Opening a public Leaf page currently waits for a per-reader container even when the reader only wants to view it. That cold start accounts for the observed multi-second load, while cached documents and a separately rolling container can expose mixed releases as CSP violations, startup failures, or flicker.
This keeps the ordinary Leaf document, projection, and append-only log model, but splits website delivery at the point where private state begins. Fresh documents and build-generated initial projections come from Cloudflare's edge. The first private request starts the canonical Python server in a per-reader container; visible active tabs hold its news stream, hidden tabs release it, and browser tabs share activation.
Implementation
Container files remain ephemeral. This change prevents a replacement from corrupting the browser's current state, but durable website sessions would require an external page-directory store.
Verified with 915 Python tests, 40 Worker tests, TypeScript, and the complete pre-commit suite.