Repository navigation
Conversation
The handover URL carries the machine-wide host key as `?t=`, and the tab kept it, so copying the address, sharing a screen, or screenshotting a page handed out every page this machine serves, present and future. The server already turns the key into a cookie on the first request, so the runtime's bootstrap now drops `t` with `replaceState`, as it already did for `_leaf-revision` and `_leaf-recovered`. The key cookie now lasts 30 days (Jupyter's login-cookie lifetime) rather than the browser session. The tab holds only the bare address, so a restored tab or a bookmark after a browser restart would otherwise be refused. Each handover link renews it. Behavior that moved in tests: the handover-arrival test now follows the link from another site and reloads the bare address. A `SameSite=Strict` cookie is withheld from requests another site starts, and the test shows the reload is still admitted. The neighbour-tray tests expect the new tab on the bare address, and `opened_tab` accepts either form, since the runtime can rewrite the target's URL before the poll sees it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 27, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
…e page, and widen samples to their data-width (#1364) Three follow-ups to #1303: two of the open focus/scroll gaps it left, and one layout bug found while presenting them. ## A pressed Send leaves the user in the box Clicking a box's Send left focus on the button, so the next letters the user typed ran page keys (an "ok" hid every mark and closed the margin card) instead of reaching the box. Pressing Send is now the send key pressed from the box, on every surface `wireInput` wires (margin card, thread panel, general box, seat Send and Send & pause, widget comment boxes): - A pointer press never takes focus (`mousedown` default prevented), so the box keeps it throughout. - A keyboard press on a focused Send returns the user to the box before submitting, so what the send does next starts from where Enter starts it. A seat that gives its box up still hands the user to the new thread's reply, and a first anchored comment still lands on the thread it starts (#961). - While an input method holds unfinished words, the press takes focus as before, since leaving the box is what finishes them; otherwise the unfinished words went out and the input method's commit wrote them back into the emptied box. `sendLanding` (thread/reply-landing.js) no longer takes the button: its "focus is on the box or its Send" guard is always true now, and box.js's Send vs Send & pause branch is gone. Tests: `test_a_pressed_send_leaves_the_user_in_the_box` (six surfaces × pointer/keyboard, the composer by pointer only since its Tab walks response options), 8 of whose cases fail on main; `test_a_pointer_send_finishes_the_words_an_input_method_holds`, which drives a composition through CDP and fails without the composition guard. Tests that expected Send focused after a click now expect the box. ## Bounded blocks are reading regions A block bounded with `data-bound`/`x-bound` scrolls on its own but registered no reading region, so every "which box scrolls this node" question answered with the page. A talk seat's first send in a bounded `lf-command` scrolled the page 117px and the second carried the block off screen; thread travel and the Ask walk into a bounded log moved the page. `bounds.js` now holds every `[data-lf-bound]` block as a region while it stands in the page, whoever painted the bound (delivery for page content since #1325, `markDeclared` for message markup). A named block in the page's own document is `lf-region:<id>:bound`, so a revision finds its place again; an anonymous one, or one in a message's frozen markup, keeps one id for its life in this document. - **One arrival watch.** `arrivals.js` (`watchArrivals(selector, attributes, { arrive, leave })`, `watchArrivalsIn(root)`) is now the one owner of "keep a paint on elements matching a declaration while they stand in the document or an enrolled shadow root". External links, which had their own document observer, and bounds both use it; shadow-stage.js enrolls each root it fills. The watch starts at boot, before presentation, so an `end` log opens at its end rather than jumping there after. - `scrollersOf(node)` (reading-regions.js) walks the boxes scrolling a node, innermost first; `holdBox` gives the move to the block and hands what it cannot take to the page. Anchor travel's `scrollingBoxFor` uses the same walk. Whether the held control is on screen at all is geometry.js's answer, so a box in a block the page has scrolled away doesn't pull the page back when an agent turn arrives. - **One "seen" reading.** geometry.js's new `seenRect` is what of an item the user sees: `shownRect` cut at top and foot by the room the banner and shortcut bar leave (`shownWindow`), its sides left to the layout viewport so a pinch zoom doesn't count as a clip. Landing, `bringForward`, read acknowledgement (`thread/read.js`) and the thread card's "being read" check all ask it; `read.js` had counted lines under the banner or bar as read, and no longer does. - Travel and the Ask walk centre the destination in the block, then scroll the page only as far as needed. - Continuity records a following `end` block's place as its end (`followingItsEnd`), so a revision keeps it following; readings of regions no longer standing are dropped. carry.js restores a region body's sideways offset and leaves the vertical one to continuity. - Margin rows for a target in a bounded block in the column's flow keep the rail (`railBeside`), their lane clipped to the block; rows in a workspace's panes still pin, as #1333 has it. - With focus inside a bounded block, `d`/`u` page the block; thread context takes the nearest labelled region. The glossary now defines a bounded block as a reading region. Tests in test_render_threads.py, test_render_navigation.py, test_render_margin.py and test_render_widgets.py cover the seat send (`end` and `start`), an arriving agent turn over a full, an unfilled, and a scrolled-away block, travel into named and anonymous logs, the Ask walk, margin rows beside the column and in side-by-side panes, `d`/`u` in a log, a bounded log in an agent reply, and a revision over a following log. Each fails with the arrival watch disabled, and all but the revision case fail on main. ## A sample fills the room its `data-width` asks for `lf-sample` is `display: table; width: 100%`, and a table box does not fill the negative margins the kernel's breakout gives it, so `data-width="wide"`/`"available"` shifted a sample left without widening it. The package theme now gives a sample its own breakout width, `calc(100% + var(--lf-surplus))`, under the same painted selector as the kernel's `table[data-lf-space]` rule. It is scoped to the sample's own breakout because `--lf-surplus` inherits: unscoped, a plain sample inside a wide section came out 1080px in a 720px item. `test_a_sample_fills_the_room_its_authored_width_takes` (test_render_pages.py) fails without the rule. ## Checks `uv run pytest tests` (1426 passed) and `npm run test:runtime` (151 passed) locally. Independent reviews ran on each of the three changes and on each repair; the browser files these touch have pre-existing failures on main (the `?t=` URL assertions after #1337, the margin `picked_up` cases, `test_a_coined_class_cannot_reach_the_chromes_rules`), each reproduced on the merge base. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
pushed a commit
that referenced
this pull request
Sep 28, 2026
The [nightly run at b263820](https://github.com/max-sixty/leaf/actions/runs/36412331832) still expected handover keys in several browser URLs. Leaf exchanges `?t=` for a cookie and removes it from the address bar during bootstrap (#1337), so those assertions fail after successful navigation. This updates the navigation cases to check the URL the user actually sees, while keeping the link destination and tab-opening assertions. The eight affected navigation cases passed locally. The external-link case also passed 18 concurrent copies with `leaf-dev flake`. Other nightly failures remain tracked in #1283. Refs #1283. Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 28, 2026
…t, the phone row inset and the overdue reading (#1400) Repairs the nightly failures in [run 36421522559](https://github.com/max-sixty/leaf/actions/runs/36421522559) that #1391 and #1392 left: thirteen failing node ids, one of which needed a product fix to the phone banner's menus. ## The phone banner's menus stand under their door On a phone the banner's action row puts More (and Versions after it) at the row's left inset, and More's menu and the Versions menu open under that door. Both menus clamped their left edge with `left: max(calc(8px + var(--lf-safe-left)), anchor(left))`. The `8px` restated the row's inset (10px then). #1338 cut that inset to 3px to fit three controls in 320px, so the clamp now binds and the menu stands 5px right of the control that opened it, which `test_the_versions_menu_uses_the_banner_panel_and_its_doors_edge` caught. The row's padding owns the inset, and the door already stands inside it, so the clamp can never be tighter than `anchor(left)`. Both menus now take `left: anchor(left)` in one rule; the second copy of the inset is deleted. The far edge is still bounded by the menus' existing `max-width: calc(100vw - 16px)`. Measured with `leaf-dev probe alert-review` (left, right edges in px): | viewport | surface | before (e730341) | after | |---|---|---|---| | 320×844 | More door | 3 – 27 | 3 – 27 | | 320×844 | Versions menu | 8 – 147.4 | 3 – 142.4 | | 320×844 | More menu | 8 – 206.1 | 3 – 183 | | 390×844 | More menu | 8 – 206.1 | 3 – 183 | | 1440×900 | More door | 1247.1 – 1283 | 1247.1 – 1283 | | 1440×900 | Versions menu | 1143.6 – 1283 | 1143.6 – 1283 | | 1440×900 | More menu, right edge | 1283 | 1283 | The More menu's width differs between the arms only because its build-identity row reads `Leaf sha256:…` on the base commit and `Leaf e730341+ · 9m ago` on the working tree; desktop placement is unchanged, since the change sits inside the `width <= 840px` block. ## Tests that read the address the bootstrap now rewrites (#1337) The bootstrap takes the host key `t` out of the address with `history.replaceState`. - `test_a_failed_preview_bootstrap_hears_the_replacement_server` (6 params) and `test_a_failed_bootstrap_hears_a_static_registry_generation` counted reloads with `framenavigated`, which also fires for that in-place rewrite (CI: `assert 2 == 1`; in the static-registry test the stub never answered because `len(navigations) > 1` held from the start). They now count the main frame's document requests (`requested_documents`), so a reload is exactly one more document and the rewrite counts as none. - `test_the_current_page_has_a_menu_local_key` read `pin` off the end of the address, which the rewrite turns into `?pin=`. It now asserts the address is the one it found before the press. - `test_a_draft_explains_its_change_and_restores_history_as_an_edit` opened its second tab at the keyless `page.url` and got a 403. It opens the handover URL `serve` returned. ## Other moved behavior - `test_a_thread_can_be_answered_in_the_margin_without_opening_threads` [1440, 1920]: since #1324 the reply placeholder paints in the standing paint on the next frame. The test read it in a microtask after `focusin`; it now reads it on the animation frame the focus asks for, after the runtime's own focus listener has queued that frame's paint. - `test_a_thread_says_what_the_agent_is_doing_about_it`: since #1331 a turn that ends with updates still the agent's to answer makes them overdue, so the banner says "Nothing is answering them, so nudge it in the terminal." The expectation follows. ## Checks All 13 node ids pass locally, and `leaf-dev flake` ran each changed test (one parameter of each parametrized one) as 18 concurrent copies: 126 of 126 passed. The banner and menu cases in `test_render_controls.py` also pass beside the CSS change, as do 54 phone, banner, menu and version cases across the anchors, aim, navigation, pages, widgets, threads and projection files. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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 handover URL carries the machine-wide host key as
?t=, and the tab kept it, so copying the address, sharing a screen, or screenshotting a page handed out every page this machine serves, present and future. The server already turns the key into thelf_keycookie on the first request, so the runtime's bootstrap now dropstwithreplaceState, as it already did for_leaf-revisionand_leaf-recovered.The key cookie now lasts 30 days (Jupyter's login-cookie lifetime) rather than the browser session. The tab holds only the bare address, so a restored tab or a bookmark after a browser restart would otherwise be refused. Each handover link renews it. The cost, stated in
host_key's docstring, is that other servers on the same host string keep receiving the key for that long after the last handover rather than until the browser quits.For comparison, Jupyter mints a token per server start, accepts it as
?token=or anAuthorizationheader, and answers it with a signed login cookie. It does not strip the token deliberately: JupyterLab's router rewrites the address bar to a bare path as a side effect, and Notebook leaves it.Behavior that moved in tests: the handover-arrival test now follows the link from another site and reloads the bare address, since a
SameSite=Strictcookie is withheld from requests another site starts; it fails with the bootstrap change reverted. The neighbour-tray tests expect the new tab on the bare address, andopened_tabaccepts either form, since the runtime can rewrite the target's URL before the poll sees it. The cookie test asserts the cookie outlives the session.Still exposing the key: the browser's history records the first visit, and the neighbour-tray links keep
?t=in theirhref, because a neighbour served under a different host string does not receive this host's cookie.🤖 Generated with Claude Code