Repository navigation
Press again for the tab the driver lost, not the one Chromium never made - #40
Conversation
# Conflicts: # tests/test_render.py
leaf-agent
left a comment
There was a problem hiding this comment.
Reviewing my own PR, so this is a COMMENT rather than a verdict.
The diagnosis holds. A fact the driver drops on its way out of the browser is not a page state a route can arrange, the reading behind it is the browser's own record rather than an inference, and all three sites that wait on a browser-opened tab now go through one helper. Two things in that helper don't yet match what its docstring promises, both inline: the except can't distinguish the tab wait's timeout from one the press raised itself, and the rate the docstring states isn't the rate the PR body measured.
One thing worth a line in the docstring rather than machinery: a lost press leaves a real, loaded Chromium tab that nothing closes, so test_a_message_reference_travels_or_says_it_cant's tab.close() now accounts only for the try that was reported. No assertion at the three sites reads a tab or a leaf count, so nothing false passes — but it is the standing cost of the repeat, and the leaked tab goes on polling its server until context teardown.
lint is green. test was still running when the poll cap expired, so the 23 browser tests this change touches are unverified from here rather than green.
|
This landed again on main: run 32907461091 on That is the second occurrence on main inside 24 hours (32790759750 at 2026-08-24 23:45Z, this one at 2026-08-25 22:42Z), with all 23 The branch is still good to merge: 3 ahead of main and 11 behind, no conflict ( |
|
Third occurrence on main, and the first since the note above: run 32920132953 on The rate has moved the wrong way. Counting Branch is still clean to merge: 3 ahead, 21 behind, |
|
Fourth occurrence, 70 minutes after the third: run 32924462601 on The rate is the only new fact. Counting completed Nothing changed on this branch: still green on its last run, |
|
Fifth occurrence: run 32946946913 on The one new fact is that the failing site moved without moving: the wait is now Rate since the first occurrence at 2026-08-24 23:45Z: 5 failures in 50 completed |
|
@tend-agent we have to fix the titles; how is this a reasonable title for the issue. it needs to be understandable for a normal person to have some idea of the problem! |
|
Fair, and it's the merge commit on What produced them: the repo's own commit titles are imperative and elliptical, and they work because their subjects — a focus ring, a key line, an ask — are things a reader of this repo already knows. I was matching that register on machinery nobody has met yet, which turns it into a riddle instead of a summary. #45 writes the rule into Applied to the one open PR already — #44 is now "Replace a 250ms sleep in the work-line test with a real control". This one and #42 are merged, so those two stay as they are. |
|
One thing the overlay in #45 can't see from inside this repo: the bundled rule already exists and never arrived here. It needed sharpening too, and #45's before/after pairs are the right instinct about why: the bundled rule stated the goal ("plain, literal language") without naming the shapes that break it, so a title written as a figure passes its own check. max-sixty/tend#1060 adds a reader test — someone who has not read the diff can say what was wrong — a bad → good rewrite using this PR's title as the example, and extends the rule to issue titles rather than PR titles alone. |
Benchmark a reply by its time, attributed to where it went The reply benchmark now measures the time from the user's comment to the agent's reply and attributes all of it, each moment once, instead of counting model calls. This follows Max's decision #40 on the overnight report: a count of model calls is a noisy proxy for the time the user waits, so the benchmark and the note's budgets are now in seconds. `reply_phases.reply_breakdown` splits a reply into: - Leaf's share: delivery, Leaf's commands, and now Leaf's hooks where the harness times them; - the harness's own work before each request; - the model's wait for the stream's first output and its generation, with each response's output tokens; - the agent's other tools, the harness's busy time and idle time. Each harness's record supplies a different part of this: - **Claude Code**: the journey reads its debug log. It pairs each first byte with its request by the elapsed time the log line states, so a prompt-suggestion stream running alongside isn't mistaken for the main thread's. The transcript gives each response's output tokens. - **Pi**: the first stream event and output tokens come from its RPC events. - **Codex App Server**: its hook durations and per-response token usage come from App Server notifications. App Server reports no request or stream start, so Codex's model time stays unsplit. The journey now breaks the release reply down once, after the session ends, from its whole record. The call that replied keeps its tokens, and reading Claude Code's transcript while it is still being written can no longer fail the journey on a partial line. `leaf-dev journey-chart --replies` prints a table with one column per target and case. Each part shows its mean and its share of the whole reply, and the parts add up to it. Model calls and output tokens remain only as diagnostic rows. `notes/user-feedback-responsiveness.md` now carries: - a fresh batch of 18 journeys, three per harness and case; - which parts each harness gives exactly and which are inferred or missing; - budgets in seconds: whole reply under 15 s, Leaf's share under 2 s. In waiting replies the model took 82–92% of the time, mostly generation: Claude Code generated at about 100 tokens a second, nearly all of it thinking. Leaf's hooks took 1.0–1.6 s a reply on Claude Code and Codex; nothing counted them before this change. The TODO entry asking what the reply budget counts is removed: the budget counts the whole reply. The website journey test's fake `run_journey` and its expected sample were stale against #3387 and #3403. They now take `commands` and expect `case`. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
An attribute that names one of the layer's words, such as `lf-column`'s
`tone` or `lf-code`'s `language`, now carries those words as a standard
JSON Schema `enum` in the vocabulary a page composes. Before this, its
schema said only `{"type": "string"}`. The words lived under `$tones`
and `$languages`, so an agent reading the entry went looking for them.
Claude Code reads `page/registry.json` directly, never `page
instructions`, and spent a model call on that lookup in most replies.
Composing the vocabulary (`registry.layer.stamp_composition`, at `page
init` and over a page's own declarations) now writes each list into the
attribute's `enum`. That is `registry.contract.stamp_words`, beside
`$decisions` and `$states`. Source registries still declare only
`x-tone` or `x-language`, so a new tag that takes a tone still needs
only that key, and the lists stay the one home of the words.
That leaves one mechanism where there were three:
- **Validation** reads the `enum` through the attribute schema it
already checks. The separate `DECLARED_WORDS` pass and its
`unknown-word` finding are deleted. An unknown tone now reads `'success'
is not one of ['ok', 'warn', 'danger']`.
- **`page instructions --use`** lists the words of every attribute whose
schema has an `enum`, read from the schema. That replaces #3690's
listing from the layer's lists.
- **Composition** stamps before it validates the examples, so examples
are checked against the vocabulary as pages read it.
This bumps the page protocol from 21 to 22. No page runtime reads the
property schemas, but a page vendored before this change carries a
registry without the `enum`. A Leaf at the same number would then stop
checking that page's tones and languages. The bump has the session
holding such a page re-vendor it on its first command, and the stamped
registry checks again.
Measured with Claude Code waiting journeys, side by side on this
branch's base `7c0aa359f` and on the change, 7 completed runs per arm:
| | Before | After |
|---|---|---|
| Registry lookup calls per reply, mean | 2.14 | 0.43 |
| Replies that looked up the tones | 6 of 7 | 2 of 7 |
| Model calls per reply, mean | 5.43 | 3.86 |
| Whole reply, median | 26.4 s | 18.9 s |
| Generation, median | 17.9 s | 13.0 s |
The whole-reply drop is within the run-to-run spread at this sample
size. The lookup is gone from most replies, and removing that lookup was
the point. One Codex App Server journey and one Pi journey were also run
to spot-check that both still see the words.
This is the coordinator's #48 follow-up to Max's decision #40 on the
overnight report.
> _This was written by Claude Code on behalf of max-sixty_
---------
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Run 32790759750 failed
test_a_message_reference_travels_or_says_it_cant—TimeoutError: Timeout 30000ms exceeded while waiting for event "page"— at the ⌃-click that opens a message reference in its own tab. Chromium opened that tab. Playwright never handed it over.Reproduced locally at 3–4 misses in 60 presses on a loaded machine, and read from the browser's own record rather than inferred. On a miss the click reaches the anchor and nothing refuses it, and
Target.getTargetsholds a second page target in the same browser context — attached, loaded, titled, sitting at the href — whilecontext.pagesstill holds one. The targets pile up press after press and Playwright reports none of them, soexpect_pagespends its whole timeout on a tab that already exists.Solution
opened_tab(page, press)makes the press again when the wait comes back empty: three tries at 10s each. A driver that loses the handle is not a page statepage.routecan arrange, and there is no second channel to reach an unreported tab through, so re-pressing is the only instrument left — the same class of repair as #26'sCutOff, and stated as such in the helper's docstring and intests/CLAUDE.mdbeside the rule it reads against.The retry cannot green a runtime that stopped leaving a real href for the platform to act on: that opens no tab for any of the tries. Bug-back, refusing only the modified press in
leaf.js's panel handler so the plain jump still works — the test fails atopened_tabin 31.9s with the same missing-tab wait.All three sites that wait on a browser-opened tab go through it. The chord is not what decides the loss: over 60 presses each, ⌃-click lost 3, ⌃⇧-click 10, ⇧-click 1.
Testing
-n0 --run-nightly): 23 passed.pre-commitclean on both changed files.The reading that named it
Three misses out of 60 presses on one page.
clicksis what the page saw of the press;targetsisTarget.getTargetson a browser CDP session, taken 1.5s after the wait gave up:Both targets carry the same
browserContextId, andbrowser.contextsstays at one context holding one page. By the third miss there are four such targets andcontext.pagesis still one: the tab is never reported, not reported late.The press is not what fails.
ctrl: Truewithprevented: Falsesays the anchor took a real modified press and the runtime let it through;detail: 1rules out the press being folded into a double-click.Automated fix for failed run