Repository navigation
Stop reloading an open page when two Leaf versions read its source - #5798
Merged
Merged
Conversation
An open page reloaded each time the page server and the agent's `leaf` commands, running different Leaf versions, looked at the same source. Since #4551 each Leaf composes the page's vocabulary from its own bundled packages, and the revision's executable digest included that vocabulary, so each version took the other's capture for a change, published it again, and every new executable reloaded the tab. In the week of Nov 2-8 that was 56 of the 79 same-tab reloads in Firefox on this machine's pages. The executable now digests only what the page owns: the generation, the annotation mode, the page's own declarations, its modules and its script elements. Runtime and bundled-package changes already reach an open tab as a server that refuses it, and selection or package-copy changes as a new generation. The manifest also drops `public_modules`, which nothing read and which differed between Leaf versions the same way. Behavior changed: two vocabularies over one source now capture the same revision (test_two_leaf_versions_capture_one_source_as_the_same_revision); the manifest no longer lists public modules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Nov 10, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
approved these changes
Nov 10, 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.
An open page now keeps its document when the page server and the agent's
leafcommands run different Leaf versions. Before, each version took the other's capture of the sameindex.htmlfor a change, published it again as a new revision, and the tab reloaded at every one.What was happening
A page server keeps the Leaf it started with, while the agent's commands run the session's current Leaf: a plugin update since the server started, or a worktree's
bin/leaf. Since #4551 each Leaf composes the page's vocabulary from its own bundled packages, so two versions compose different vocabularies whenever any bundled registry changed between them, which most commits do.A revision's
executabledigest decides whether an open tab patches in place or loads a fresh document, and it included a digest of that composed vocabulary. The revision's identity (its manifest digest) includesexecutable. So on every state read the server captured the source as revision N with its vocabulary, the agent's nextleaf thread replycaptured the identical source as N+1 with its own, the server's next read captured N+2, and so on. Every revision had a different executable from the last, and each one reloaded the tab.Evidence from the pages on this machine, read from each page's
observations.jsonland revision manifests:executable. Before that day there were none.leaf page stateon one page: 6 reads made 6 revisions with alternating executables onmain, and 1 revision with this change.The change
The executable digest now covers only what the page owns: the layer generation, the annotation mode, the page's own declarations (
page/registry.json), its modules and its script elements. What an open document runs under comes from the serving Leaf, and each part already reaches the tab by another route: a runtime or bundled-package change as a server that refuses the tab (runtime_selection), and a new selection or changed package copy as a new generation (vendoring).The manifest also drops
public_modules, the capturing Leaf's list of public runtime modules, which nothing read and which minted duplicate revisions the same way whenever that list changed between versions.Behavior change in tests:
test_two_leaf_versions_capture_one_source_as_the_same_revisionholds that two vocabularies capture the same revision and that a change to the page's declarations still loads a fresh document;test_authored_lazy_positioning_import_uses_the_runtimes_public_providerno longer asserts the droppedpublic_modulesfield.What's left
leaf package install) and updated while a server runs changes what the next revision runs under without changing the generation or the runtime identity, so the tab now patches in place and keeps the old widget code until it reloads. The vocabulary digest caught this only when the update changed the package's registry; an update to its modules alone already escaped it. No page on this machine selects an installed package. The fix is to judge the reload against what the server serves the revision with, the execution identityruntime_selection.executingalready computes for resource addresses, or to have an install move the generation of the pages that select it.declarationsandimplementationsstill list the capturing Leaf's layer-owned tags, so two versions that differ in which bundled widgets exist still mint a duplicate revision, which patches in place rather than reloading. Making them page-owned changes what an older Leaf at the same protocol reads, so it belongs with the next protocol bump.