Repository navigation
Have a leaf.page visitor's focus compose the page's layer in their container - #5812
Merged
Merged
Conversation
…ntainer The focus prewarm only started the container, so the first write still spent most of its admission composing the page's layer. The Worker now posts /_leaf/agent/prewarm, which starts the container and composes the focused page's layer through registry.storage.selected; the process keeps it, so the write finds it done. On 1 vCPU in the website image, admission of a write sent 2 s after focus fell from 0.93 s to 0.17 s. Composing every page at boot was tried and dropped: it took 2.0 s and slowed a write that arrived meanwhile from 1.13 s to 1.47 s.
…ning a thread Opening a thread focuses its comment box, which since #5802 starts the session's container for the reply. verify-site opened the saved thread before checking that the revision resource and document came from the Durable Object, so the prewarm could wake the container first; publish-site for #5802's merge failed with 'private revision resource woke its container'. The thread check now runs after the checks that reading left the container asleep.
leaf-agent
previously approved these changes
Nov 10, 2026
This was referenced Nov 10, 2026
# Conflicts: # dev/leaf_dev/commands/verify_site.py
leaf-agent
approved these changes
Nov 11, 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.
When a leaf.page visitor focuses a text box, the Worker's prewarm (#5802) now asks the session's container to compose the page's layer, rather than only starting the container. The visitor's first write then finds the composition done instead of paying for it.
Why here. A first write spends most of its admission composing the page's layer (theme, package modules, merged registry), which
leaf.layerkeeps only in process memory. Shipping it pre-built in the image would need a saved form of those caches in main code, so this computes it earlier instead: website code calls the publicregistry.storage.selectedfor the focused page. Everything is inworker/.Measured in the website image with a stub page store, on 1 vCPU, admission of the first write (median of 2–3 runs):
Composing one page takes about 0.9 s on 1 vCPU. Composing all 47 at boot took 2.0 s and slowed a write that arrived meanwhile, so the container composes only what the focus names.
Changes. The container answers
POST <page>/_leaf/agent/prewarmby composing that page's layer and logginglayer_prewarm_completed.prewarmContainerposts there through the session's Durable Object, which starts the container as before.tests/process/website_server/test_dispatch.pyand the Worker's prewarm test cover each side.