Skip to content

Serve passive website sessions from the edge - #427

Merged
max-sixty merged 5 commits into
mainfrom
codex/web-release-simplify
Sep 8, 2026
Merged

max-sixty merged 5 commits into
mainfrom
codex/web-release-simplify

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

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

  • The site build now emits a validated routing manifest, one static state projection per revision, release-addressed runtime assets, and hard-links duplicate build outputs.
  • The Worker establishes a cheap browser identity without allocating a container, serves passive state from the edge, and routes private requests to one session container. Release, layer, and server-incarnation headers make stale responses reload coherently.
  • Deployments build and push a uniquely identified container image, pin its registry digest, retain active sessions for a bounded drain period, and verify the exact public release in Chrome before succeeding.
  • Browser and Worker regressions cover historical revisions, concurrent first interactions, passive-to-active transitions, cross-tab activation, session replacement, media roots, immutable assets, and invalid routes.

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.

This was written by Codex on behalf of @max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread worker/src/index.ts Resolved
@max-sixty
max-sixty merged commit 541cab2 into main Sep 8, 2026
25 checks passed
@max-sixty
max-sixty deleted the codex/web-release-simplify branch September 8, 2026 02:42
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