Skip to content

Give the walk somewhere to travel before reading the fold - #19

Closed
leaf-agent wants to merge 2 commits into
mainfrom
fix/ci-32347077962
Closed

leaf-agent wants to merge 2 commits into
mainfrom
fix/ci-32347077962

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

ci has been red on main since a704f9e, on four consecutive runs (32346818351, 32347050377, 32347077962, 32347187122), always at the same line of test_the_ask_walk_reaches_an_ask_that_draws_no_box — the precondition assert page.evaluate(on_screen) is False, with assert True is False. Nothing about the walk is broken: the assertion reads a frame the page is still moving through. The first n starts a glide toward the centred ask above the change, and the test reads the fold on the frame that press returned on — so which of "off screen" and "on screen" it sees is a race between the browser's first scrolled frame and the test's next read. It is the shape tests/CLAUDE.md names in "A state the page passes through is not a state to poll for".

The settled position is not the one the precondition wants either, and that is the half a wait alone would not fix: live-question and sug-refill are adjacent in ASKS_PAGE, the change starts forty-five pixels below the fold and centring the first ask closes that gap rather than widening it — the glide brings the change up onto the screen. Measured on this branch's parent, the change sits at top=348 in a 400px window once the scroll rests — visible — while the mid-glide frame a quick machine catches reads top=411. Every machine settles the same way; only the read timing differs, which is why a workstation passes and the runner does not.

Solution

Two halves, matching the two things that were wrong.

The room is stated rather than inherited: ASKS_APART is ASKS_PAGE with one 400px passage between the first two asks, so the change is 361px below the fold when the first landing rests. A distance in pixels cannot be spent by a runner's font metrics the way forty-five pixels of incidental gap can. It is a variant local to this test rather than a change to the corpus, so the page every other ask test reads stays as it was.

The read waits for the fact instead of racing it: wait_for_function("scrollTop > 0") then SCROLL_STILL — the movement observed first, then its stillness, which is the pairing the sibling scroll tests already use and the contract that constant carries.

Testing

uv run pytest tests/test_render.py — 415 passed, 2 skipped. pre-commit run --files tests/test_render.py clean.

Measurements and bug-back

Where the change sits, at 900×400, after the first n (content rect of #sug-refill, and whether it is on screen):

ASKS_PAGE (before)          ASKS_APART (after)
before press  [445, 517] F  before press  [858, 930] F
immediate     [411, 483] F  immediate     [801, 873] F   <- what a quick machine reads
+100ms        [348, 420] T  settled       [761, 833] F   <- what every machine settles on
+1000ms       [348, 420] T  after 2nd n   [164, 236] T

The old test's pass depended entirely on the immediate column; the runner reads the row below it.

Bug-back, so the test still catches what it names — reverting scrollToElement's shownBox(el) to el.getBoundingClientRect(), the line a704f9e added, sends the travel to the top of the document:

FAILED tests/test_render.py::test_the_ask_walk_reaches_an_ask_that_draws_no_box
  - playwright._impl._errors.TimeoutError: Page.wait_for_function: Timeout 30000ms exceeded.

With the runtime restored it passes again.


Automated fix for failed run

`test_the_ask_walk_reaches_an_ask_that_draws_no_box` asserted that the change
is off screen after the walk's first landing, and read that on the frame the
press returned on — a frame the glide it starts is still on its way out of. It
is the shape tests/CLAUDE.md names in "A state the page passes through is not a
state to poll for": the page passes through "off screen" and settles at "on
screen", so which of the two the assertion sees is a race between the browser's
first scrolled frame and the test's next read. This machine won it and every
main run since a704f9e lost it.

The settled position is what the read is worth having, and in the corpus that
position fails the precondition on any machine: the two asks the walk steps
between sit next to each other, so centring the first leaves the second fifty
pixels below the fold and the glide brings it up. So the room is stated rather
than inherited — one 400px passage between them, in a page variant this test
serves — and the read waits for the movement and then for its stillness, which
is the pairing the sibling scroll tests already use.

Bug-back: with `shownBox` in `scrollToElement` reverted to the wrapper's own
rect, the travel goes to the top of the document and the test fails on its own
wait, so it still catches what it names.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on the runner, and the diagnosis holds: I reran the measurement on this branch's ASKS_APART and on ASKS_PAGE, and got the table in the description back exactly — #sug-refill before press [858, 930], immediate [827, 899], settled [761, 833], against ASKS_PAGE's settled [348, 420] and on screen. The scrollTop > 0 wait has room too: #live-question is top=164 h=267 in a 400px window, so scrollToElement computes 164 - (400-267)/2 = 97, and the press would have to lose about a hundred pixels of that before the wait had nothing to consume.

One correction, inline: the comment on ASKS_APART puts the fifty-pixel gap on the wrong frame. Forty-five pixels below the fold is where the change starts, before any press; centring the first ask closes that gap rather than leaving it — settled, the change is at top=348 and visible. As written the comment describes the state under which the wait alone would have fixed the test, which is the one thing this variant exists because it isn't true.

Overlap worth reconciling before either lands: #13 names this exact predicate in the same file — SCROLLED = "() => document.body.scrollTop > 0" — and rewrites SCROLL_STILL's comment to say the wait "is only ever asked after the movement itself has been observed. Both callers take SCROLLED first." This PR adds the third caller and spells the predicate out inline, so whichever merges second owes the other the constant and the count. Not a suggestion here, since SCROLLED doesn't exist on main yet.

ci is green on this head (lint and test both SUCCESS), and tests/test_render.py::test_the_ask_walk_reaches_an_ask_that_draws_no_box passes for me on this Linux runner.

Comment thread tests/test_render.py Resolved
Centring the first ask closes the gap rather than leaving it: the change starts forty-five pixels below the fold and rests at top=348 in a 400px window, on screen. The comment described the state under which the wait alone would have been the whole fix.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

This failure recurred on the next commit to land: run 32347187122 on f757529, same assertion, same line. It has now gone red on three consecutive main runs — 32347050377 (2a1ec4a), 32347077962 (23bf8df), and 32347187122 (f757529) — so it is the deterministic shape rather than the contention one, and this PR covers all three.

I diagnosed run 32347187122 independently and landed on the same reading, so rather than open a second PR I checked this branch out on a Linux runner and ran it: the test passes, and the measurement in ASKS_APART reproduces — on the unmodified page the change rests at top=348 in a 400px window once the first landing settles, while a frame mid-glide reads 411, which is the 63px the loaded runner was losing. Bug-back holds too: with scrollToElement's shownBox(el) put back to el.getBoundingClientRect() — the line a704f9e added — the test fails at page.wait_for_function(on_screen), so it still catches the regression it names rather than passing on the precondition alone.

Commands and output

On b4b3c17:

$ uv run pytest tests/test_render.py::test_the_ask_walk_reaches_an_ask_that_draws_no_box -q
1 passed in 3.45s

With the runtime reverted:

$ uv run pytest tests/test_render.py::test_the_ask_walk_reaches_an_ask_that_draws_no_box -q
        page.wait_for_function("() => document.body.scrollTop > 0")
        page.wait_for_function(SCROLL_STILL, arg=SETTLE_MS)
>       page.wait_for_function(on_screen)
E       playwright._impl._errors.TimeoutError: Page.wait_for_function: Timeout 30000ms exceeded.
1 failed in 32.97s

Geometry on main at 900x400, after the first press lands on #live-question (range bounds of #sug-refill, innerHeight 400):

mid-glide  top=411 bottom=483   -> off screen, the reading that passed
settled    top=348 bottom=420   -> on screen, the reading a loaded runner gets

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Still red, and now on a fifth consecutive main run: 32399632207 on 35a8c6b, same assertion at the same line. The streak is f93f0aa, 2a1ec4a, 23bf8df, f757529, 35a8c6b — every push since a704f9e, which itself went green once (32342861729) before the run after it flipped, which is the race this PR describes rather than a second cause.

The new commit is worth a word because it touched the same file this branch edits: 35a8c6b parametrized EXAMPLE_SWEEP_CASES and SPECIMEN_EXAMPLE_CASES in tests/test_render.py. The branch still merges onto main with no conflict, and the merged tree is green — the named test passed three runs in a row solo, and the whole of tests/test_render.py came back 404 passed, 13 skipped under the same eight-worker layout CI uses. So nothing here needs rebasing; it is only waiting on a merge.

Verification on the merged tree

Merged fix/ci-32347077962 (b4b3c17) into main (35a8c6b) locally — clean, tests/test_render.py only.

$ uv run pytest tests/test_render.py -k test_the_ask_walk_reaches_an_ask_that_draws_no_box -q   # x3
1 passed in 5.15s
1 passed in 2.42s
1 passed in 3.00s

$ uv run pytest tests/test_render.py -q
404 passed, 13 skipped in 278.75s (0:04:38)

For contrast, the same test on unmerged main passes solo here too (1 passed in 27.19s) — solo runs read the mid-glide frame the old precondition wanted. It is the loaded eight-worker run that reads the frame after it, which is why the failure shows up on the runner and not on a workstation.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Withdrawing this — 4bead16 fixed the same test on main, and ci went green on it (run 32412299510, 808 passed), ending the five-run streak.

It answers the same two halves this branch did and answers them better. The precondition is no longer a claim about the fold at all — it records document.body.scrollTop before the press and asserts the walk ended below where the reader started, which is the direction the boxless-travel bug cannot produce, and it does that without needing a variant page to hold the two asks apart. The wait became SCROLL_SETTLED, which is the same pairing this branch reached for under the name SCROLL_STILL, and the on-screen reading tightened to top >= 0 && bottom <= innerHeight. The commit's own comment names the thing that made the old precondition fragile — giving the question a label set one more line, and the fold moved.

The branch stays up for the record; nothing here is worth rebasing onto that.

The second failure from run 32411981438 is a separate race and is in #20.

@leaf-agent leaf-agent closed this Aug 20, 2026
max-sixty pushed a commit that referenced this pull request Sep 18, 2026
`notes/workspace-followups.md` has been presenting finished work as the
plan since 9 September. It opens with "Start #2, #3 and #4 as one
coordinated contract batch; run the review-queue simplification #8
alongside it" — all four of those shipped that week — and carries
thirteen briefs, each with a live "Next task" and "Done when", for work
`TODO.md` dropped as complete. This removes them and leaves the six
`TODO.md` still links: #11, #14, #19, #20, #22 and #23.

The trim follows the convention #666 set and the reason `CLAUDE.md`
gives for it: a note is never a second specification for shipped
behavior. #666 removed #6, #7, #16 and #17 the same way, rewriting the
two `Owner / dependencies` lines in surviving briefs that named them; it
simply did not reach the rest.

Each removal is evidenced by the commit that took the item out of
`TODO.md`, not by a reading of the current code:

| Brief | Removed from `TODO.md` by |
| --- | --- |
| #1, #3, #5 |
[`0f7f06a6`](0f7f06a)
— "Completed workspace items #1, #3, and #5 are removed from `TODO.md`"
|
| #2, #4, #8, #9 |
[`28b5da99`](28b5da9)
— "the completed #2, #4, #6, #8, #9, and #17 backlog entries are removed
while preserving the deferred evaluation work" |
| #13, #15 |
[`6df40353`](6df4035)
— "closes three bounded workspace follow-ups" |
| #10, #12 |
[`c9eaa2c6`](c9eaa2c)
— the continuation cue and the adaptive Threads placement |
| #18, #21 |
[`e46c8b93`](e46c8b9)
— the monitoring workspace and its package-owned root |

Alongside the briefs, three group headings are now empty and go; the
`Suggested work packages` table loses the rows whose whole scope landed;
and four cross-references that named a removed ID are rewritten — #14's
dependency on the Threads-placement experiment, #20's ordering behind
#8, and the two sentences in `Reproduction record` and `Browser
evidence` that pointed at briefs no longer here.

#14 needed more than a rewritten pointer. The experiment it waited on
was settled in two steps, and only the first removed an ID: [PR
#520](#520) kept the adaptive
placement and deferred the modal-focus work to #24, which landed in [PR
#536](#536) as inertness, dialog
semantics and focus containment for a covering workspace. That is the
surface #14 exists to verify, so its `Done when` — "Avoid imposing a
modal focus trap on a nonmodal panel" — described the containment #536
shipped as the defect to avoid. It now states the containment the
shipped modality requires, and the dependency line names both
settlements.

The dated evidence sections themselves stay. They are the record of what
was read in a browser on 8 September, not a plan, and the note's own
header scopes them to that date.

No test covers `notes/`, and this changes no behavior, so there is
nothing to regress. `pre-commit` passes on the file; the `TODO.md` →
note anchors all still resolve, and no surviving text references a
removed ID.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
The README now describes the harness only, with a section on its state:
early, and improved by each session that runs it. The first run's
results leave it (git history keeps them at 5e7fc3a); their follow-ups
are recorded under #19 in notes/workspace-followups.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
#1171 rewrote "Composing a page" and added "The rail and the margin",
so the plain arm's anchors no longer matched and `arms` stopped on main.
The plain arm now replaces both sections, and drops the --sheet-max
fallback for refs before the rename, whose anchors fail anyway. The
backlog's #19 names #1171 rather than the session's Ask numbers, and the
layout TODO points at the harness.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
#1172)

Adds the arrangement eval harness under `notes/arrangement-eval/`, and
records its first run's follow-ups under #19 in
`notes/workspace-followups.md`.

The eval asks whether Leaf's arrangement vocabulary (`lf-grid`,
`lf-workspace`/`lf-pane`, `data-width`, and the layout idioms) makes an
agent's pages better than laying them out in its own CSS. Fresh `claude
-p` authors write a document, a dashboard and a queue in two arms built
from one ref, then revise each page for a standing 900px preference. A
blind judge compares screenshots at three widths, once with each arm as
page A.

- `harness.py`: a single uv script with a click CLI (`arms`, `run`,
`score`, `shoot`, `review [--flip]`, `summarize`). Its docstring holds
the design: the layout on disk, how each child is isolated, and how the
review is blinded.
- A run's phase counts only when every trace through it finished without
error and loaded no memory (`Run.usable`). Scoring, review scheduling
and the pair tally all apply that test. Phase 1's page directory is
saved whole when phase 1 ends, so the phase-1 render never picks up the
revision's assets.
- `plain_arm.py` builds the plain arm from a payload. It now works on
main's guide as rewritten by #1171, and `arms HEAD` builds and passes
its smoke page.
- `README.md` describes the harness only. A "State of the harness"
section says the harness is early and lists what the first run left
undone, and a session that runs it improves it in the same change.
- The first run's results are left out of the tree. Their full write-up
is the README at
[5e7fc3a](https://github.com/max-sixty/leaf/blob/5e7fc3acf988d45649421a0b66483165cdefb57c/notes/arrangement-eval/README.md#results).
#19 carries the headline: on #1171's layout the plain pages won 11
pairs, the leaf pages 4, and 3 split; the vocabulary cut page CSS about
fourfold but not turns. #19 also lists the defects each run exposed, one
line each.
- The layout TODO on testing recipes with agents now points at the
harness.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
The stills follow the column-width grid and the edge trim. The backlog's
#19 follow-ups keep only the rail findings, since this branch fixes the
stacked-workspace split, the pane's empty top band and the grid past the
prose edge.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 25, 2026
…im edges through bare wrappers (#1178)

Three layout defects the blind arrangement comparison (#1172) found on
Leaf pages, after #1171 made the page one kind.

**A grid takes the column's width in a column page.** `lf-grid` no
longer declares `x-space: "wide"`, so in a column page it lines up with
the prose, as a paragraph does; `data-width="wide"` or `"available"`
asks for more, as on a figure. On a wide page nothing changes. Tiles and
figures running past the prose's right edge was the defect the judge
named most on Leaf documents (7 of 12 judgments). At 720px a counted
grid of plain cells fits three 224px tracks, so `columns="4"` of
sections lays out three and one; a row of `lf-metric` tiles keeps four
on the metric row's 9rem floor; `1fr 2fr` (stacks below 43.5rem = 696px)
stays side by side. The registry entry and `page-authoring.md`
"Composing a page" say so; the feature gallery's three charts take
`data-width="wide"`.

**A stacked workspace scrolls instead of splitting the window.** A root
workspace holds the window from 720px, but its template grid stacks at
its own width (`1fr 2.4fr` below ~786px). Between the two, the stacked
panes shared the window height: at 820px the queue showed two tickets
and the detail pane was cut off at its first fields. A stacked `lf-grid`
now passes no held height on (`--lf-passes-hold: 0`), so its panes take
their natural height and the page scrolls, as the workspace entry
already promised.

**A frame trims the edge margin through bare wrappers.** A frame trimmed
its first and last child's margin, but a bare wrapper there (a section
with no inset) passed its own first child's margin to the frame's edge,
so a detail pane that wrapped each ticket in a section opened on a 48px
empty band. The trim now follows the edge down through registered,
non-inherited `--lf-edge-start` / `--lf-edge-end`. This replaces #1173's
`lf-ask`-specific rule with the general one. Across the corpus 59
elements lose an edge margin, among them an Ask's options at the foot of
a page (14px) and a first heading inside a wrapper at a frame's top.

`notes/workspace-followups.md` drops the three findings from #19's
follow-ups; the rail findings stay. The catalog stills are refreshed.

Tests: `uv run pytest tests` and `npm run test:runtime` pass; pre-commit
clean. Tests that measured a grid wider than the column now declare the
width; the stacked-workspace and edge-trim cases have their own tests,
and #1173's Ask tests pass on the general rule.

> _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 added a commit that referenced this pull request Sep 25, 2026
…and scope the render check to one width

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 26, 2026
The render check already renders at 1200px and 540px and sweeps sideways
overflow from 360px to 1200px, so the TODO item and #19's render-check line
now name what reads one width: the readings the arrangement eval asked for.
#19 also drops the lf-diagram and lf-options items, which #1196 and #1198
landed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 26, 2026
…record the arrangement eval's follow-ups (#1195)

Follow-ups from the arrangement eval (#1172), picked on the review page.

- **Log order.** Every Leaf author in the eval put the request's
newest-first log in an `lf-grid` tile, bounded it with
`data-bound="end"`, and reversed it to match, because the Bounds
paragraph offered `end` for a log and said it keeps the log on its
newest line. The judge cited the reversal in 8 of 12 dashboard
judgments. The paragraph in `page-authoring.md` now has the author
choose the order for the reader and bound that order (`end` for a list
growing downward, `start` for newest first), and `lf-chronology`'s entry
says it shows entries as written.
- **Preferences.** `AGENTS.md` listed preferences "stated once and
honoured on every page" among what Leaf gives the user, but nothing in
Leaf holds one. The promise goes, and `SKILL.md` tells the author to
save a standing preference in the host's memory.
- **Widths.** `TODO.md` gains an item beside the mobile ones. The render
check already renders at 1200px and 540px and sweeps sideways overflow
from 360px to 1200px, but nothing measures the eval's other width
failures, labels drawn below legibility and an Ask below its pane's
first screen; #19 adds those at 1200px first, and the TODO takes them
across widths after.
- **Backlog.** #19 in `notes/workspace-followups.md` records why the
authors reversed the log and drops the items this and the sibling PRs
settle.

> _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 added a commit that referenced this pull request Sep 26, 2026
#1197 added the label-size advice beside the sweep this branch split out, so
once() now reads the labels, then sweeps and reads overflow and stacking from
one set of widths. #19 drops the drawn-text and stack-width items the two
PRs settle, and the TODO widths item names what still reads one width.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 26, 2026
All three Leaf queues in the arrangement eval chose `lf-grid
columns="1fr 2.4fr"`, which stacks at the user's 900px window, and no
author could see it. The render check now advises, for each template
grid that stacks in a window 800px or wider, the window width it stacks
below, e.g. `<lf-grid id=queue> stacks into one column in a window
narrower than 854px`.

The grid's need comes from `lf-grid.js`'s own `stackWidth`; the window
is interpolated from the existing 360–1200px sweep, since how a grid's
width follows the window is piecewise. No new viewports. The probe keys
each grid by its document-order index, so two grids that share a name
(id-less grids a module writes) are read apart across the sweep.

A board is the one template that stacks in a desktop window by design:
in `3fr 1fr` the triage board shows all four columns at 1200px and
stacks below 1000px, where it takes the page's width; in `2fr 1fr` it
cuts its fourth column at 1200px and shows one at 900px.
`page-authoring.md` keeps `3fr 1fr` for a board and now says it stacks
below 1000px on purpose, so the advice the triage-board example draws is
expected.

With #1197 merged, #19 in `notes/workspace-followups.md` drops the
drawn-text and stack-width items the two settle, and the `TODO.md`
widths item names what still reads one width.

Tests:
`test_a_template_that_stacks_in_a_desktop_window_gets_advice_naming_the_window`,
`test_two_templates_sharing_a_name_each_get_their_own_stacking_advice`.

> _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 added a commit that referenced this pull request Oct 3, 2026
Leaf's eval dependency tree installed a vulnerable FTP directory-listing
parser through Promptfoo → proxy-agent → get-uri. Scope an npm override
to get-uri's basic-ftp dependency and select 6.2.1, which fixes
[CVE-2026-102990](GHSA-c475-qrg2-pj4r).
The latest get-uri still requests basic-ftp 5.x; [upstream
#502](TooTallNate/proxy-agents#502) tracks
that constraint.

Regenerating the lock also removes 14 unused entries already marked
extraneous, including the unused braces dependency reported in [alert
#20](https://github.com/max-sixty/leaf/security/dependabot/20).
Basic-ftp is the only retained package whose version changes. Two
MongoDB optional-peer entries previously marked extraneous are retained
with npm 10's required optional/peer metadata so CI can install the
lockfile. Existing platform-specific libc selectors are preserved.
Node-forge remains installed and [alert
#19](https://github.com/max-sixty/leaf/security/dependabot/19) remains
unresolved. These findings came from [October's review
tracker](#1501).

Validation: clean npm 10.9.9 installs with full scripts and with
`--ignore-scripts --omit=optional`; all six eval assertion tests; 81
focused Python eval-runner tests; one real Promptfoo echo evaluation
through Leaf's runner; pre-commit and diff checks. Actual local FTP
sessions through installed get-uri retrieve identical bytes with both
MDTM and MLSD fallback. A crafted 128 KiB Unix LIST entry blocks past a
10-second subprocess deadline on basic-ftp 5.3.1; the patched dependency
returns the expected missing-timestamp error in 0.13 seconds. This
exercises the parser through get-uri's real fallback rather than
replacing its calls.

Basic-ftp 6 rejects separate transfer hosts by default, providing its
FTP bounce-attack protection. Ordinary local passive transfers pass the
compatibility check.

> _This was written by Codex on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Oct 12, 2026
… a reply to a withdrawn message (#2507)

Python code that restated a rule a stronger mechanism already enforces,
explained malformed agent input the agent would fix from a plain
refusal, or recovered from states no Leaf writer produces. It goes; what
stops bad input passing silently into admitted events, stored decisions
or anchors stays. One confirmed bug is fixed on the way. Part of the
complication-weight sweep (#19–#24 and #30 there).

**Bug: a reply to a withdrawn message opened a phantom thread.**
Admission checked a reply's `parent` against every message in the log,
withdrawn ones included, while the thread fold drops withdrawn ones; so
a reply to a reaction the user took back was admitted and landed in a
second thread named after the withdrawn reaction. `_parent_error` now
refuses a withdrawn parent, and `UndoReading` counts any child, a
reaction included, as standing on a reaction, so every standing
message's parent stands. The fold reached the phantom through recovery
written for a torn opening line, which the writer cannot produce (it
fsyncs before returning an id and repairs a torn tail before the next
append); that recovery goes from `build_threads`, `seat_root`,
`thread_context` and `logged_id`, with its two tests.

**Restated rules (#19):** the start line's one-line rule now lives once
in the kernel registry, including a progress reply's `start`;
`record_pickup`'s phase, `cmd_wait`'s argument pair, `deferred_value`'s
re-checks, the `Unresolvable` catch, the JSX refusal (the browser check
reports it), the `check_app_server_endpoint` alias, the
entries-are-dicts check and the `user_views` JSON round trip (now
`deepcopy`) go.

**#20:** the `fcntl` ImportError fallback goes; Leaf runs only on POSIX
and a plain import fails as early.

**#21:** `capture_anchor` refuses a missing quote with one message
instead of diagnosing fences, removed words and data bodies (the
retired- and gone-section refusals stay); `leaf data set` no longer
explains empty stdin; `task open` no longer explains a thread subject
the schema refuses.

**#22, #24:** `activity._moment` stops tolerating timestamps no Leaf
writer produces; the interaction log stops re-validating on read what it
validated on write: it skips a torn line, and marks a split record whose
parts don't join into the entry they name as `interaction_unreadable`
(ingress checks each part, not the whole).

**Rules moved to their owners (#30):** the layer's `$` fact shapes are
one `LAYER_FACTS_SCHEMA`, leaving only cross-references and what a
schema can't say in code; `delivery.pending_batches` is gone for
`hook_transport.read_plans`; `codex run --handshake` is required; the
`RANK` pattern and identity fields' non-emptiness are in
`detail_schema`. Patterns that replaced a `fullmatch` end with
`(?![\s\S])`, because Python's `re` lets `$` match before a final
newline. `lf-suggestion`'s rules stay in Python: no existing declaration
can say how many slots it holds or that it can't nest.

**Behavior changes:** a reply or reaction to a withdrawn message is
refused; a reaction to a reaction blocks undoing the parent reaction;
refusals read as the schema's or parser's message; a log that already
holds an orphaned message (possible only from the bug above) now fails
to read instead of showing a phantom thread.

The browser runtime's half of #23 is in the runtime cuts PR, which
follows this one.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 21, 2026
On leaf.page, a visitor who has only read a page no longer starts a
private container by being shown an agent message. The runtime used to
post a `read` event on its own once a message had been fully on screen,
and the Worker forwarded it to a new private container. Now the runtime
sends no read until the visitor's session is active, as it already sends
no viewport report (`user-view.js`), and the Worker answers any read
that arrives from a passive session itself without recording it. Once
the visitor acts on the page, reads are recorded as before, including
for a message already in view. This implements Max's decision #19 on the
overnight report.

Until the visitor acts, their read messages keep their unread marks and
Next unread keeps stopping on them. Before this change, each published
example with an agent reply in it (ship-review, review-a-plan,
log-retention) started Python and Codex App Server in a container for
every visitor who opened that reply, and the container then idled for
ten minutes.

## How

- `thread/read.js` counts a message's exposure only while
`sessionIsActive()`, and scans again on `lf-session-active`. When the
visitor's first gesture activates the session, a reply in view is marked
read in the same visit. On a locally served page and in a live sample
the session is always active, so nothing changes there. The kernel is
rebuilt.
- The Worker answers a passive session's `read` itself, beside the
viewport report it already drops ("disposable observation, not a gesture
that opens private state"). It reads the event's `kind` in the same
bounded parse that recognizes a page fault (`passiveEvent`). The answer
is a final refusal under a 200, `{ok: false, final: true, findings: [],
attempt}`, as `page check --render` has answered since #3299, and not
the viewport report's empty 204. The runtime treats an empty answer as
unreached and would send the read again on every later pass, and those
passes run on each scroll. This answer only reaches a tab whose runtime
predates the gate above.

## Checks

- A Worker test beside the viewport one posts a read with no cookie,
with a session cookie, with this page's active marker from another
release, and with another page's marker. Each gets the final refusal and
no container. With this page's active marker, the read goes to the
container. Disabling the new branch fails the test.
- Through the local Worker (`leaf-dev verify-site`'s `local_worker`),
with `ship-review` built from this branch, a fresh visitor opened both
threads with `t`. No `/api/event` was posted and no container started.
The session was then turned active over its session channel, the way
another tab's activation reaches it. The same tab then posted reads for
both replies, `91f7c2a8` and `64df0b27`. A control tab whose state
answers said `active` from the start posted the same two reads.
- `pnpm run check` passes.
- `uv run leaf-dev site` then `uv run leaf-dev verify-site
website-worker` passes. Two earlier runs on a host at load 20–25 timed
out on the container's first activation read, and the same timeout hit
main's Worker on that host.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Nov 6, 2026
…is HTML's phrasing less what draws its own box; shipped chips gain their spaces

Where words are read (#21). The runtime found the element a run of words is read in
after the walk, by climbing each text node's parents past inline tags, so a staged
widget's top-level `<span>` climbed to its shadow root and stopped there: two widgets
side by side under a `<div>`, each holding a `<span>`, read "alpha beta" before they
staged and "alphabeta" after, where the file's reading kept "alpha beta". The reading
walk now carries that element in its context (`enter`, `words`), as passages.py
carries each element's block, across shadow roots as across the light tree, and a
slot's words are read among the words where the slot draws them. Each segment carries
it; a space stands between two runs read in different elements or across a line break
(`spacedFrom`), in the raw reading as in `quoteFrom`. `segmentTextBlock` and its climb
go.

Which elements join words (#20). `$passages.inline` listed 28 tags and missed
`<output>`, so `alpha<output>beta</output>gamma`, drawn and found by both browsers as
one word, read "alpha beta gamma". It goes. `$passages.phrasing` comes in as on
link-previews (4b056fc), JSON and `why-` text alike, so that merge is trivial, with
`$passages.apart`: the phrasing elements drawn as boxes of their own, each with its
reason, from the review's table of what each engine draws and finds (controls:
button, select, datalist, textarea, meter, progress; embedded content: audio, video,
canvas, iframe, object, picture, svg). Every other phrasing element, and a widget
declared `x-inline`, runs into the words beside it: output, label, slot and a ruby's
base among them. Both readings derive the set from the two facts (`JOINS_WORDS`,
`JOINS_WORDS_TAGS`). An element outside the set, a text block or a widget among them,
reads its words apart, inside a text block too: `alpha<button>beta</button>gamma` in a
`<p>` now reads "alpha beta gamma" in both. The file's reading no longer reads text
blocks at all, so `why-blocks` stops claiming they decide spacing. link-previews'
`why-phrasing` says only the browser reads the list; that sentence changes at the
merge, since the file's reading now reads it too.

Said values. An `x-says` value is drawn as its element's caption (lf-sample), label
(lf-column) or popover (lf-gloss), never among the element's words. The file's
reading read one apart only outside a text block and the browser's never did, so a
label beside its element's own words read "Headbody" in the browser and "Head body"
in the file, and a gloss's tip in a paragraph "glossTip" in both. Both now read every
said value apart (`enter`'s `SAID`, `_said`).

Shipped chips (#19). The option chips in examples/heat-loss.html, adjacent `<small>`
elements with nothing between them, draw as separate boxes but read
"£180one afternoon", so search for "£180 one afternoon" found them on main and not
here. They now have whitespace between them, as do the same chips in three of
packages/default/registry.json's `x-example`s, the site nav's example in
docs/package/registry.json, and four figure captions in docs/ui.html whose label is a
block by CSS alone. No other adjacent chips stand in examples/, docs/, packages/ or
skills/.

tests/quote_cases.json gains an output, a ruby's base, a widget's slot drawing two
spans, a button's label in a text block, two staged widgets side by side, as one word
and as two, and a said label and a said tip; its browser side renders said values.
Both runtimes answer all 27. A runtime test holds that a slot's words run into the
shadow tree's words around it.

Tests, each failing on c8bddac in Chromium and Firefox:
- test_page_search_finds_words_an_output_runs_into (#20);
- test_page_search_reads_two_staged_widgets_side_by_side_apart (#21), with the shared
  staged cases failing in the browser's runtime test on c8bddac and passing in
  Python there and here;
- test_page_search_reads_a_said_label_apart_from_its_elements_words.
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.

1 participant