Repository navigation
Resolve the layer of the tab's revision in one place - #3099
Merged
Merged
Conversation
Since #2725 (2026-10-12) a tab whose page was re-vendored under it reloaded at once, mid-keystroke, and without the revision handoff that carries the user's place and open editor. The cause was the freshness token: /api/news answered in the page's newer layer, which the stale tab refuses; #2725 pointed the refusal's source probe at the page-root registry, which now says the source moved, so layer-client.js reloaded immediately. State, event and deferred answers already spoke the layer of the revision the tab names, so the version controller would otherwise have taken the newer layer as a revision with a changed executable: a fresh-document install that waits while the user composes and hands their place across. Every authorized answer now defaults to the layer of the revision the tab names (`_named_layer`), and the news look sends the layer headers that name it. A tab on the page's own layer skips the lookup. Behaviour change: a re-vendor reloads an idle tab through the revision handoff, and a tab with an unsent comment or reply follows only once it is sent or dropped; before, both reloaded on the next news answer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A revision saved at another protocol admits no input (`incompatible_revision`), so holding a composing tab on it would strand the user's send against a final refusal. `_named_layer` answers such a tab in the page's layer, which it refuses and reloads at once, as before. Also corrects version.js's note on how a re-vendored layer reaches `prepareActivation`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # tests/browser/test_render_drafts.py
Five places on the page server worked out which layer an answer speaks for the revision a tab reads: the default every authorized answer takes (`_named_layer`), the write gate (`_layer_gate`), and the state, deferred and view routes. They disagreed in rare cases: a tab naming no revision after a re-vendor whose source failed to save, and a write from a tab on a revision past a protocol bump. `named_revision` now says which revision the tab reads: the one it names in the query or `Leaf-View-Revision`, or the active one. `_revision_layer` says which layer a tab reading it speaks: the revision's own, or the page's where this Leaf refuses the revision or there is none. The default, the gate and the state route call them; the deferred and view routes take the default. `requested_view_revision` loses its header-only mode, which only POSTs used and which read the same header they always send. The default no longer skips the lookup for a tab on the page's own layer: it costs about 22 µs against 0.5-1 ms for the news answer it rides on. Behaviour changes: - A write from a tab on a revision past a protocol bump is answered with the page's layer, so the tab reloads at once as its news already made it, instead of reaching the event door's final refusal. - A tab naming no revision speaks the active revision's layer everywhere, rather than the page's vendored layer on reads and the active one on writes. - A state answer naming no revision speaks the layer of the revision its read left active, which may be newer than the one resolved before the read activated the source. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/scripts/leaf/http.py # tests/process/test_interact_server.py
leaf-agent
approved these changes
Oct 16, 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.
The page server worked out in five places which layer an answer speaks for the revision a tab reads: the default every authorized answer takes (
_named_layer), the write gate (_layer_gate), and the/api/state,/api/deferredand/api/viewroutes. They agreed for ordinary tabs and disagreed in rare cases: a tab naming no revision after a re-vendor whose source failed to save, and a write from a tab on a revision past a protocol bump. This follows #3098, which made every answer default to the layer of the revision the tab names.In
skills/leaf/scripts/leaf/http.py,named_revisionnow says which revision the tab reads: the one it names in the query orLeaf-View-Revision, or the active one._revision_layersays which layer a tab reading that revision speaks: the revision's own, or the page's where this Leaf refuses the revision or there is none. The default, the gate and the state route call them; the deferred and view routes take the default.requested_view_revisionloses its header-only mode, which only POSTs used, and they send the same header either way.The default no longer skips the lookup for a tab on the page's own layer. The lookup costs about 22 µs, measured against 0.5–1 ms for the
/api/newsanswer it most often rides on.Behaviour changes:
Tests:
test_a_tab_on_a_revision_past_a_protocol_bump_hears_the_newer_layernow also sends a write, andtest_a_state_answer_speaks_the_layer_of_the_revision_it_readis new. Each fails without its part of the change.