Skip to content

Make the root tab strip a cover, count covers stuck at their inset, and use one shadow climb - #1028

Merged
max-sixty merged 21 commits into
mainfrom
tabs-cover-room
Sep 23, 2026
Merged

max-sixty merged 21 commits into
mainfrom
tabs-cover-room

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The root lf-tabs strip becomes a declared cover, and one reading of "stuck" makes document covers count at all. Private copies of the shadow-crossing climb and containment check now use the ones in shadow.js.

Causes

  • The root strip measured its own room. lf-tabs kept --lf-root-tab-clear with its own ResizeObserver, so the strip was never a cover: the on-screen readings (shownRect, read acknowledgement, arrival checks, chrome placement) counted what it hid as shown.
  • Document covers never counted as stuck. insetBand took a cover as stuck only when it straddled the scroller's top edge. A document's covers stick under the banner at top: var(--lf-banner-h), so they never reach the root's edge. Measured on the root-tabs fixture, with the strip stuck at 42–89px, visibleBand(document.scrollingElement).top stayed 0. The same holds for each pinned lf-diff file header in the document, which Answer "on screen" and "cover room" once, and give packages the place hold #1013 declared, so that declaration had no effect in any live page.
  • Containment had three spellings. passages.js exported containsAcross(ancestor, node), visual-parts.js kept a private copy of it, and projection/data.js had a third (containedBy). shadow.js's under(node, root) answers the same question. The parent climb (upFrom) was also restated in seven places, "the node's stand-in in tree X" in three, and the rendered-tree climb through slots in two.

Changes

  • lf-tabs declares its strip through declareCoverRoom(document.documentElement, "--lf-root-tab-clear", …) while it is the root set, and withdraws it when it stops being root. Only a set that declared withdraws, so a tab set nested in a root panel cannot clear the root's strip. The hand-rolled observer and the clear-on-disconnect path are gone, because a cover that leaves the document is let go on its own.
  • insetBand also counts a cover as stuck when it sits at or above the sticky inset it is held at (stickyTop / stickyBottom, read from the cover's computed style in coversByScroller). A stuck cover takes the band from the edge to its foot, including the inset, which is the room kept clear for the banner. The straddle rule still applies, so the thread list's negatively inset run headings behave as before.
  • declareCoverRoom measures a host's first covers as they are declared. A first observation arrives after the frame's layout. The old lf-tabs code wrote the strip's height during its own render, so the initial fragment landing read --lf-root-tab-clear as 0px and stopped a strip's height short. A cover that replaces another starts at the room its host already keeps, so a thread-list reconcile still forces no layout. leaf-agent's review found this, and a runtime fold test pins it. The test fails with the measurement removed.
  • declareCoverRoom registers its property through setRuntimeRootStyle when the host is <html>, so revision activation treats it as runtime-owned, as the old lf-tabs code did.
  • Containment cutover. containsAcross and its copies are deleted, and every call site uses under(node, root), with the argument order swapped. Its rationale comment moved beside under. Private parentAcross, up, and inline parentElement ?? getRootNode().host climbs use upFrom, including those in render-checks/ through widget-api.js. A new hostIn(node, root) in shadow.js replaces the three "climb out until this tree" loops in passages.js, asks/view.js, and conversation/placement.js. A new renderedParent (the slot a slotted node renders in, else upFrom) replaces the two rendered-tree climbs in anchor-travel.js and margin-projection.js.
  • scrollerFor. The code is right: a widget in a reply resolves to .lf-threads, checked in the browser, because mountPanelReadingRegion registers the list as the panel's bounded reading region. The comment now says why.

Behavior that moved

  • Content under a stuck root tab strip, or under a stuck lf-diff file header in the document, now reads as off screen. While such a cover is stuck, the banner band above it reads as off screen too. test_a_stuck_root_tab_strip_hides_what_passes_under_it pins the strip case, with the unstuck strip at the page top as its control.
  • After the root set leaves, --lf-root-tab-clear stays at 0px instead of being removed. The theme's fallback is 0px, so nothing reads the two differently.

Left as is

Where no cover is stuck, the banner itself is still not a cover: content under the translucent banner reads as on screen. Making the banner a cover of the root is a product call about the veil, and it would move every on-screen reading near the page top.

Tests

  • npm run test:runtime: the insetBand fold gains the sticky-inset case, both stuck and passing through.
  • New browser test above. After merging main, focused --run-nightly runs of the widgets, navigation, anchors, projection, and read-state files: 628 passed. An earlier run before the merge also covered the conversations and controls files, with one failure that failed the same way on the merge base. Everyday uv run pytest tests: 1373 passed.
  • pre-commit.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

max-sixty and others added 18 commits September 23, 2026 10:19
notes/guidance-duplication.md lists the rules Leaf's agent-facing guidance states
in more than one place: SKILL.md, references/, package guidance and registries,
$events handling and answering, agent-facing Python strings, protocol sidecars
and hand-copied docs. It gives every site and a proposed single home for each
rule. Seven rules already disagree between copies, and in nearly every case the
short copy (a CLI help string, a delivered clause, a docs paragraph) is the one
that leaves out a case.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Readers are all author "user" today, so a page cannot record who
moved, commented or voted, or who has it open. The item records that
gap next to how Claude Code Artifacts handle it: a viewer id on each
row, with names, faces and presence resolved from the host.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nd use one shadow climb

The root lf-tabs strip keeps its room through declareCoverRoom instead of its own
ResizeObserver, so what it hides reads as off screen. insetBand now counts a cover
stuck at its sticky inset, since document covers stick under the banner and never
straddled the root's top edge (this also makes #1013's lf-diff headers count in the
document). containsAcross and the private containment and parent-climb copies are cut
over to shadow.js's under and upFrom, plus a new hostIn for the three
climb-to-this-tree loops.

Behavior moved: content under a stuck root strip or document lf-diff header is off
screen, as is the banner band above it while one is stuck.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Leaf reaches a Codex task one of two ways, and they differ in who writes the
reply. The default `codex queue` transport (the desktop app, IDE extensions, an
ordinary CLI) hands each delivery to the task as a queued `leaf-delivery`
message; the adapter acknowledges it, and the agent answers every obligation with
explicit commands, `leaf reply` included, as in Claude Code. The App Server
transport (`leaf codex launch`, `--app-server`) makes Leaf a client of the task's
App Server: it starts each delivery's turn with a `leaf_delivery` tool output and
takes the turn's final message as the reply.

- host-codex.md now covers only the queue transport and the adapter-free routes
  (an in-turn `leaf wait`, a watcher task); the new host-codex-app-server.md
  covers App Server. SKILL.md routes between them on LEAF_CODEX_APP_SERVER.
- The `answering.reply` clause, ANSWER_ASK_INSTRUCTION, event-batches.md, and
  conversation-loop.md name the App Server case instead of "a host that sends it
  as the reply"; the delivered-handling snapshots move with the clause.
- A later `leaf codex start` in a task reports the running adapter's transport,
  which the adapter now records in its lease, and refuses an --app-server
  endpoint the adapter is not on rather than ignoring it.
- Docstrings, session-lifetime.md, scripts/AGENTS.md, and how-it-works stop
  calling the queue a fallback or labelling App Server state as Codex-wide.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nch (#1026)

Claude Code's session list (`claude agents`) groups a background session
by how its last reply ends. It moves the session to Needs input only on
a `needs input:` line. The rule asking for that line sat in
`host-claude-code.md`, which the agent reads hours before the closing
reply it governs. Replays of session e390c26f's final turn showed that
neither that wording nor a note in the `leaf wait` envelope got the line
written (0/6 across settings).

A `PostToolUse` hook now adds the rule to the tool result of each `leaf
wait` launch, the last thing the agent reads before its closing reply.
In the same replay that got the line written 6/6: 3/3 with a user
CLAUDE.md, 3/3 with project settings only. It wrote none (0/6) on a turn
where nothing was owed.

- `hooks/hooks.json`: a `PostToolUse` Bash entry with `"if": "Bash(*leaf
wait*)"`, which prints `hooks/wait-started.json` only when `CLAUDECODE`
is set and the payload names `leaf wait`. Codex 0.156.1 runs the same
file, ignores `if`, and fires the entry on every shell call, as I
measured, so the command checks both itself rather than relying on the
filter.
- `host-claude-code.md`: "Session list" keeps the mechanism (the row
reads Working while `leaf wait` runs) and points at the hook file, so
the rule has one home.
- `TODO.md`: when to route tool-result guidance through `leaf hook`
instead of static text, and the case for making `leaf hook` cheap enough
to use that way. It costs about 0.3–0.5s warm and 2.5s cold today, and
the host waits on it.
- Test: runs the registered command through `sh` with a hook payload and
checks that it prints the guidance under Claude Code and nothing
otherwise.

> _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]>
## Summary

The published visual evidence test reopens the Web Awesome case selector
twice. An option records its value before the listbox finishes hiding,
so the next click can close a still-open selector and leave the next
option hidden. Wait for each option to be visible before selecting it
and for the listbox to finish closing before the next iteration.

## Checks

- `uv run pytest
tests/test_site.py::test_published_visual_evidence_loads_from_its_page
--run-nightly -n2 -q`
- `uv run pre-commit run --files tests/test_site.py`

> _This was written by Codex on behalf of max-sixty_
Leaf called the person viewing a page and commenting on it the "reader",
while every event it records already says `"author": "user"`. The term now
matches the field everywhere: prose, references, the glossary, code
identifiers, CSS classes and data attributes (`data-lf-user-override`), the
attention kinds and waiting values (`needs_user`, `awaits_user`,
`next_actor: "user"`), the preview's `--user` flag and `-user` slot, and the
runtime modules `user-intent.js` and `user-place.js`. No alias keeps the old
names.

"Reader" stays where it meant something else: a screen reader, code or a
process that reads data (the passage reader, schema readers, a log's
line-splitting reader), a maintainer reading a failure or a reference, the
code-reader comparison example, and fixture prose about cache readers.

Test names and assertions moved with the rename; snapshots, the corpus, and
the browser runtime bundle are regenerated.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Marking a thread read moved the reader. The unread rail indented a
message's content by 8px, and each **New since you last looked** / **End
of this new section** boundary added 29px of height. A receipt removed
both, so the prose rewrapped, the card got shorter, the scroller
clamped, and a landing could cut through a text block. #999 handled one
trigger with a microtask in `thread-card.js` that re-landed the focused
reply after a receipt. This PR removes the reflow itself.

Every read mark now takes space the layout already has:

- **Rail**: a `border-image` outset into the message's inline margin. It
uses no space, and neither the message nor the hoisted root header needs
a positioning context. A `position: relative` on the root header would
have pulled `.lf-going`'s absolutely placed actions 8px inward.
- **Boundary**: a zero-height block. Its margins collapse through it, so
it sits at the next message's edge, and its label sits in the 16px gap
between messages. A boundary that is the first child of its container,
like the one opening a checkpoint's originals, has no margin above it to
collapse with. It sits at the start of its gap, so its label hangs below
it.
- **Hoisted root header**: the row now uses `align-items: center`
instead of `baseline`. With baseline alignment, removing **Mark thread
read** shifted the author line down by 4px.
- The re-land microtask from #999 is deleted.

`skills/leaf/assets/AGENTS.md` now includes the rule next to the single
reading of unread: reading is bookkeeping, and a receipt changes no box
the reader is looking at.

## Tests

- New `test_reading_a_thread_moves_nothing_in_it`: records the box of
every element in a card before and after a server read receipt, and
requires every one to stay the same. The only exception is the summary
row, message metadata, and header actions: when they lose a label or
control, they may close up horizontally but not vertically. The thread
has two `new` boundaries, one `end` boundary, and a root rail. On main's
CSS the test fails (the card goes from 606 to 526px tall, and 62 boxes
move).
- The summary-originals test now also checks that the opening boundary's
label clears the **Show messages** control.
- `test_pressing_a_page_mark_stands_in_the_thread_it_opens` (all 4
params, `--run-nightly`) passes without the microtask. It also passed on
main's CSS without the microtask in 20 of 20 concurrent runs, so it no
longer reproduces the race #999 addressed. The new test is what pins the
no-reflow property.
- `--run-nightly` for `test_render_navigation.py`,
`test_render_conversations.py`, `test_render_read_state.py`, and
`test_chrome_contracts.py` after merging current main: all 328 pass.
- `npm run test:runtime` and pre-commit pass.

> _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]>

@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.

declareCoverRoom writes nothing on a first declaration, so --lf-root-tab-clear is unset for a frame and a landing taken in that window arrives behind the stuck strip. Its tail paints only when a cover leaves:

  const left = [...prior.keys()].filter((cover) => !next.has(cover));
  for (const cover of left) letGo(cover);
  coverRooms.set(host, { property, covers: next });
  if (left.length) paintCoverRoom(host);

A newly declared cover enters next at 0 and gets its height from the observer's first delivery. That is fine for the covers already on this path, whose consumer is a scroll-margin inside a scroller the reader has to reach first. It is not fine for the one this PR adds: #syncStickyClearance wrote the strip's height inside the widget's own render, so scroll-padding-top: calc(var(--lf-banner-h) + var(--lf-root-tab-clear, 0px) + 12px) was already correct when the page's initial hash landing ran. On this branch that landing can read the 0px fallback and stop 47px high — with the target under the strip, which is what the declaration exists to prevent.

test_root_tabs_reach_the_chosen_contents_and_follow_browser_history catches it, because plan_start is the initial landing and the later click-restore is compared against it.

Evidence

Single test, -n0, 8 spinning shells on a 4-core runner:

uv run pytest tests/test_render_widgets.py -q -n0 --run-nightly \
  -k test_root_tabs_reach_the_chosen_contents_and_follow_browser_history
  • 419d766: 3 of 10 runs failed, always assert 176 == 224 ± 2
  • 2e278f4 (merge base): 10 of 10 passed

Settled, both refs land at 176 with scroll-padding-top: 101.297px and --lf-root-tab-clear: 47.296875px; the strip measures 47.296875px, which is the 48px gap. 224 is the landing calc(42px + 0px + 12px) gives.

Declaring a fresh cover on a fresh host in the browser: host.style.getPropertyValue(property) reads "" immediately after declareCoverRoom returns and "37px" two frames later.

Seeding a newly declared, connected cover from its own box before the paint would close it. That costs the getBoundingClientRect the header comment currently avoids — the same read #syncStickyClearance was making — and only for a cover the set has never seen. Happy to push it if you want it.

max-sixty and others added 3 commits September 23, 2026 11:56
The first observation comes after the frame's layout, so the root strip's room
read as 0px for the initial fragment landing, which stopped a strip's height
short (leaf-agent's review). A replacing cover now starts at the room the host
keeps.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/AGENTS.md
#	skills/leaf/assets/runtime/geometry.js
# Conflicts:
#	docs/how-it-works.html
#	hooks/wait-started.json
#	notes/guidance-duplication.md
#	skills/leaf/assets/AGENTS.md
#	skills/leaf/assets/registry.json
#	skills/leaf/assets/runtime/geometry.js
#	skills/leaf/packages/command-hub/guidance/coordinator.md
#	skills/leaf/packages/command-hub/registry.json
#	skills/leaf/packages/default/registry.json
#	skills/leaf/packages/playground/guidance/author.md
#	skills/leaf/packages/swipe/guidance/author.md
#	skills/leaf/packages/swipe/registry.json
#	skills/leaf/packages/visual-review/guidance/author.md
#	skills/leaf/references/authoring-asks.md
#	skills/leaf/references/authoring-evidence.md
#	skills/leaf/references/authoring-revisions.md
#	skills/leaf/references/conversation-threads.md
#	skills/leaf/references/host-claude-code.md
#	skills/leaf/references/packages.md
#	skills/leaf/references/page-authoring.md
#	skills/leaf/scripts/leaf/cli.py
#	tests/_regtest_outputs/test_interact_contract.test_each_case_of_an_event_is_told_what_the_snapshot_shows__0/snapshot.yaml
#	tests/_regtest_outputs/test_interact_layer.test_agent_interaction_command_help.out
#	tests/_regtest_outputs/test_interact_session.test_agent_sees_the_complete_interaction_recovery[receipt]__0/snapshot.yaml
#	tests/_regtest_outputs/test_website_server.test_hosted_agent_receives_the_response_instructions_and_delivery[receipt]__0/snapshot.yaml
#	tests/_regtest_outputs/test_website_server.test_hosted_agent_receives_the_response_instructions_and_delivery[version]__0/snapshot.yaml
@max-sixty
max-sixty merged commit bc116a2 into main Sep 23, 2026
5 checks passed
@max-sixty
max-sixty deleted the tabs-cover-room branch September 23, 2026 19:46
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