Skip to content

Unify message workflow and derive thread attention - #933

Merged
max-sixty merged 13 commits into
mainfrom
codex/thread-data-ontology
Sep 22, 2026
Merged

max-sixty merged 13 commits into
mainfrom
codex/thread-data-ontology

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Message status used separate delivery, response, and attention classifiers. An informational agent update could hide an earlier unanswered question, and stale work could retain active styling. This change projects one exact-input workflow and derives thread attention from it plus outstanding reader Asks.

The canonical reading combines delivery, work claims, and response evidence; the browser publisher adds unresolved sending and refusal. Messages, compact thread rows, margin entries, agent APIs, and website adapters consume that reading. Page-wide activity remains separate. A terminal failed response retains its historical “Not answered” mark, while its recovery obligation ends when the reader resends.

The backend owner is skills/leaf/scripts/leaf/workflows.py, with lifetime qualification in activity.py. Browser publication lives in scripts/browser/application.ts, and presentation in runtime/conversation/workflow.js. Owning contracts and the production gallery are updated; independent jobs/delegation, notification subscriptions, and unread tracking remain deferred.

Validation includes the everyday Python suite, focused conversation/margin/options browser cases, browser model and build gates, Worker typechecking and tests, lint, and independent review. Matched browser comparisons exercise standing questions, keyboard submission, and Escape navigation.

This was written by Codex on behalf of max-sixty

Project delivery, work and exact response evidence once; overlay local sending and refusal at publication. Preserve standing reader asks, qualify stale work, and retire terminal recovery on resend. Keep overall page activity separate.

Cut browser, agent and website consumers over to workflows. Update production gallery evidence and contracts, and align existing Escape assertions with the landed panel navigation behavior.
Share local-send construction and live-work predicates, select strongest work in one pass, and index widget workflows once per publication. Rename the Python owner to workflows and remove redundant claim bookkeeping. Retire duplicate design notes while preserving remaining Thread plans.
# Conflicts:
#	tests/test_render_margin.py

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

The compact thread row goes blank while a message is in flight. navigationSummary now reads model.resolved ? "Resolved" : model.attention?.label || "", and attention only ever comes from the server — readThreadRecords passes thread.attention ?? null, and _apply_thread_attention is the sole writer. The publisher overlays the local sending workflow into thread.workflows but never into attention, so threadAttention falls through to its final return null and the row renders an empty string. The message itself still says Sending; the row beside it says nothing, for exactly the flight in which the reader is looking for it.

Measured on the merged tree against the arrangement in test_a_refused_comment_takes_its_message_back_and_returns_the_words, the pending thread card's aria snapshot:

base ff34b91 this branch
pending thread card The comment the server will refuse. 1 Sending You The comment the server will refuse. 1 You

That is the invariant root CLAUDE.md states under Cross-runtime invariants — "Every forward gesture whose semantic result the page can draw is on screen in the turn that sends it, before the log answers". It also swallows the refusal behaviour this PR's own session-lifetime.md claims: "A local send refusal similarly has a browser-owned Retry gesture; that unresolved overlay may put the thread in Needs you without persisting another workflow record." Nothing reaches Needs you, because a refused local send leaves thread.attention null too. threadAttention already computes strongestWorkflow(thread.workflows) on that path and discards it, and the server emits attention: null only when it holds no workflow for the thread, so the local reading is the only candidate there. Suggestion inline.

The margin's workflow face lost both of its channels at once. agentWorkflowFace now returns text: label and context: workflowTitle(receipt), so a sent, queued or picked_up row's quieter line is a verbatim repeat of its own label — "Sent" under "Sent · …" — and the age that line used to carry (ago(receipt.ts), rendered as the bare age or as "Checked in 3 minutes ago") is gone from every workflow row and from its aria-description. Separately, Working's detail moved out of the visible label into the description, which is what turned the aria-label assertions in test_render_options.py into aria-description ones; that move is a judgement call, but losing the timestamp isn't announced anywhere, and the gallery prose this PR keeps still promises "the transient label with its quieter context".

One thing I did not reproduce, so treat it as a question rather than a finding: visibleWidgetWorkflows dropped the receipt.revision <= runtime.currentRevision bound that visibleAcknowledgments carried, and readThreadRecords dropped the matching receipt.revision <= document.revision on widget receipts. Each view's projection is built from the whole log against that revision's document, so a coordinate an older revision still resolves keeps its entry in projection.desired, while canonical_workflows only ever emits page actions from the active revision — which reads as a margin row for current-revision work appearing while the reader has travelled back. CLAUDE.md names the bound ("Page-widget state is bounded by document version; widgets frozen into thread markup use the conversation window"), so if dropping it is deliberate for frozen thread widgets and an oversight for the page margin, they want separating.

What I ran
  • npm run test:runtime, npm run check:browser, npm run test:browser, npm run typecheck --prefix worker, npm test --prefix worker — all green.
  • uv run pytest tests/test_interact_session.py tests/test_website_server.py tests/test_interact_server.py — 421 passed; 4 failures are all OSError: [Errno 97] Address family not supported by protocol from AF_UNIX in this sandbox, unrelated to the diff.
  • uv run pytest tests/test_render_conversations.py tests/test_render_margin.py tests/test_render_options.py — 271 passed, 1 failed: test_g_hints_reach_a_late_visible_action_only_location. It fails identically on the merge base ff34b91907ec25f48f5013c338381a5bf03ed032, so it is not this branch's.
  • tests/test_render_drafts.py::test_a_refused_comment_takes_its_message_back_and_returns_the_words also fails on both the merge base and this branch, on its expect(pending).to_be_focused() line — also not this branch's. Its aria snapshot on each side is the evidence in the table above.

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

readThreadRecords still assembles the thread record's attention from the server value alone — attention: thread.attention ?? null — and the publisher immediately maps over every record it returns to overwrite that field with projectThreadAttention(thread.attention, thread.workflows). Both inputs are already in hand inside the fold: thread.attention, and the threadWorkflows binding this commit extracts there and then uses exactly once. That single-use extraction is the tell that the projection was written in the callee and moved out.

What it leaves behind is a rule nothing in the shipped tree states. The same commit drops threadAttention's strongestWorkflow(thread.workflows) fallback, so conversation/workflow.js now requires an already-projected attention while conversation/model.js — the one module that builds that field — does not produce one, and the only thing reconciling them is a .map() in scripts/browser/application.ts, which ships as a bundle rather than as source. tests/runtime/conversation-workflow.test.mjs already calls readThreadRecords directly; a record obtained there, or by any second caller, carries the raw server attention and renders the blank compact row the previous round fixed, with nothing in skills/leaf/assets/ to say why. Folding the projection into the fold closes that, and projectThreadAttention is idempotent over its own output, so the two suggestions below are safe to apply in either order.

The rest of the commit holds up. The local-send attention overlay reaches the compact row without displacing a standing Ask or an accepted server reading, the margin's quieter line carries the receipt age again, and splitting the revision bound — isPageWidgetWorkflow for the page margin, the conversation window for widgets frozen into thread markup — is the right answer to the bound visibleAcknowledgments used to carry, stated by the test that names it.

Verification

Run on the merged tree at 6e79a96:

  • npm run test:runtime (40 passed), npm run check:browser (bundle current), npm run test:browser (61 passed).
  • uv run pytest tests/test_render_margin.py — 127 passed. uv run pytest tests/test_render_conversations.py — 99 passed. Those are the two browser boundaries the compact row's attention and the margin's workflow face cross.

Candidates I chased and dropped: the publisher's obligated remap can mark awaits_reader where the server's attention says waiting, but asks.reader derives from the same server reading, and the foldThreads case the comment there describes is one the server already resolved to reason: "ask" before folding; claimActivity reads workflows() with no revision bound, but every row it decorates is already gated by update.revision > runtime.currentRevision; isPageWidgetWorkflow admits a null revision through null <= n, which is what visibleAcknowledgments did on main too; and dropping threadAttention's fallback is only reachable for reason: "ask", where it corrects secondary rather than losing a label, since the excluded workflow?.id is no longer the strongest agent workflow.

Comment thread scripts/browser/application.ts Resolved
leaf-agent
leaf-agent previously approved these changes Sep 22, 2026

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

Sending a reply no longer moves the thread's turn in the turn that sends it. projectThreadAttention in conversation/workflow.js opens with if (attention?.kind === "needs_reader") return attention;, so it answers from the server's reading before it ever looks at workflows — and the unresolved sending workflow the publisher adds there is exactly what should retract that reading. Measured on PANEL_PAGE with an agent reply carrying awaits, holding the reply's POST on a route:

.lf-thread-status while the reply is held base 254fdd45 this branch
text Sending On you
data-lf-turn absent reader

The same window on a failed thread: a resend leaves Not answered and the blue reader turn standing, and only clears to Sent once the log answers. The description says the recovery obligation ends when the reader resends, and session-lifetime.md hands recovery to that resend; it ends a round trip after the gesture that is supposed to end it. This is the invariant root CLAUDE.md states — "Every forward gesture whose semantic result the page can draw is on screen in the turn that sends it, before the log answers" — and the same one the first round's blank compact row was against.

The panel's own filter still reads the raw field, so moving margin, Page Map, and the compact row onto attention leaves it contradicting the rows beneath it. matchesState in conversation/narrowing.js resolves "reader" through awaitsReader(thread), and the thread.reader binding's when: in conversation/panel.js gates on threadList().some((...args) => awaitsReader(...args)). On the failure-receipt arrangement from test_a_host_failure_receipt_does_not_read_as_an_answer, this branch paints data-lf-turn="reader" on both the margin marker and the thread row, which reads Not answered in blue — while the On you filter directly above that row is aria-disabled="true" with title="Nothing is waiting on you", and w is not offered at all. On the base all three agree that nothing is owed. The reader is told a thread is on them and given no route in the panel to it.

Both are one seam. foldThreads writes the reader's retraction into awaits_reader, and the publisher's obligated remap writes a standing Ask's re-assertion into that same field, while the canonical reading everything is moving onto is attention, which neither of them touches. Consumers that have moved see reader turns the fold already retracted; consumers that have not miss the ones the server only expresses as attention. One question, two fields, and nothing states which wins — that is what the change is against, whether it lands as the local overlay writing attention beside awaits_reader or as projectThreadAttention taking the folded record rather than its attention field alone, with the raw field retiring from presentation once it does.

The rest of the commit reads well: keeping a concrete Ask ahead of a recovery in the aggregate is right, and the new margin assertions do fail against the base, so they pin the reading they name. Happy to push the reconciliation if you want it in this PR rather than behind it — worth knowing #945 is open on conversation/narrowing.js.

Verification

Both findings were reproduced first at 129ffc98 and re-verified at 1c5638a5 after the base merge landed mid-review; that merge's own conflict resolutions are test-only and reach neither conversation/ nor the margin modules.

The control is 254fdd45 in its own worktree with its own uv sync. Reusing this checkout's environment runs the branch's Python server against the base's assets, which reports the base as already carrying attention — worth knowing before trusting a base comparison here.

  • npm run test:runtime (42 passed), npm run check:browser (bundle current), npm run test:browser (61 passed).
  • uv run pytest tests/test_render_margin.py — 127 passed.
  • uv run pytest tests/test_render_conversations.py — 98 passed, 1 failed: test_the_fold_never_paints_a_frame_that_undoes_the_last. It passes alone under -n0 on this branch and on the base, so that is the sandbox's parallel run rather than the branch.
  • Both comparisons are held-route probes: page.route("**/api/event", …) collecting the send, then reading .lf-thread-status and the margin marker before releasing it.
  • The server reading behind the second finding, for the failure-receipt thread: awaits_reader is false, attention is {"kind": "needs_reader", "reason": "recovery", "workflow": …}, and asks.reader is empty. The two fields disagree by construction there, and each surface reports whichever one it reads.

@leaf-agent
leaf-agent dismissed their stale review September 22, 2026 19:21

Superseded by the review on a later commit.

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

awaitsReader no longer reads the field this module's own instructions say it reads. This commit makes it !thread.resolved && thread.attention?.kind === "needs_reader", so attention is the browser's whole answer to whose turn a thread is and the raw awaits_reader decides nothing on that side — which is the reconciliation the last round asked for. The two documents that route a reader to the old authority still name it:

  • skills/leaf/assets/CLAUDE.md, under "Each mutable fact has one writer", still sources "whose turn each thread is" from "each thread's awaits_reader" — suggestion inline. Its Authoritative projection section then states the retired rule outright: "Python also supplies each thread's awaits_reader; awaitsReader reads that field." That line is outside the diff, so it can't take a suggestion; the accurate replacement for it and the two sentences after it is below.
  • skills/leaf/references/packages.md lists awaits_reader and attention side by side on the public Thread record without saying which one answers whose turn. On the failure-receipt thread this commit's own new case builds they disagree by construction — the server sends awaits_reader: false beside attention: {kind: "needs_reader", reason: "recovery"} — so a package author reading the documented field gets the opposite answer from the panel filter beside it.

That is the last consumer of the two-field seam: the code picked a winner, and the sentences pointing the next reader at the loser stayed. Happy to push both edits rather than leave them as suggestions.

skills/leaf/assets/CLAUDE.md, replacing the paragraph beginning "Python also supplies each thread's"

Python supplies each thread's raw `awaits_reader` and its aggregated `attention`;
`awaitsReader` reads `attention`, so a thread whose agent turn failed is the reader's
even where `awaits_reader` is false. `runtime/conversation/model.js` clears that
attention when an unresolved reply hands the thread to the agent, and the application
publisher restores it for a standing reader Ask that reply cannot answer.
What I ran, and the re-target

The review re-targeted from e7dc37c9 onto b7f18eda mid-pass; the push is the two base merges and no new authored commit. Both new browser assertions in tests/test_render_conversations.py failed deterministically at e7dc37c9 — the reader filter's label is You/You (N), never On you, and a selected choice is never disabled — and 6f61f12c's own conflict resolution rewrote both against main's filter work. Worth knowing because that file is pytest.mark.nightly, so the PR's test job deselects it and neither failure would have shown before main.

Run on the re-targeted merged tree (97cb7bac):

  • uv run pytest tests/test_render_conversations.py — 101 passed, including both re-resolved cases alone under -n0.
  • npm run test:runtime (43), npm run test:browser (63), npm run check:browser (bundle current).
  • uv run pytest tests/test_render_margin.py at the reviewed commit — 128 passed. The margin modules are byte-identical across the re-target.

Candidates I chased and dropped: retiring next_actor to "none" never flattens a margin receipt's waiting face, because workflows.py only ever hands the reader a workflow that also carries a failed-response condition, and agentWorkflowFace keys on either; the obligated remap's workflow: null loses nothing, since served_state/browser.py emits "workflow": None for every reason: "ask"; a pending reaction cannot retire a thread's attention, as pendingMessages excludes reactions; and a locally resolved thread keeps needs_reader in its record, which both awaitsReader and threadAttention gate on resolved before reading.

Comment thread skills/leaf/assets/CLAUDE.md Resolved
@max-sixty
max-sixty merged commit 50a9fed into main Sep 22, 2026
5 checks passed
@max-sixty
max-sixty deleted the codex/thread-data-ontology branch September 22, 2026 20:21
leaf-agent added a commit that referenced this pull request Sep 22, 2026
#933 removed the receipt element from message rendering: nothing under
skills/leaf/assets/runtime/ writes .lf-receipt or data-receipt-id any
more, and a message's status is the .lf-msg-sending span its head
carries, labelled from conversation/workflow.js. The case's root and
per-message readings still named the old element, so it failed above
this branch's own go-to-threads and filter repairs once main moved.

Each reading now takes the workflow line under the same head, with the
claim detail on its title where the receipt used to spell it inline.
The identity probes still hold: the span is retained across the pickup
update on both surfaces.
max-sixty added a commit that referenced this pull request Sep 23, 2026
The Thread navigation playground stopped building: #915 and #933 added
four before/after lf-shots whose eight PNGs were never committed, and no
copy survives. Nothing built a note's page before a reader previewed it,
so both landed green.

test_page_fixtures_pass_check now takes every notes/**/*.html beside the
examples, and reads each fixture's own layer and media directory instead
of assuming examples/. The playground drops the two uncaptured comparisons
of those landed changes; its other shots and seeded discussion are intact.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 23, 2026
…osure and message workflow line (#951)

`ci` on `main` is red. The complete suite on
[fd25b4a](https://github.com/max-sixty/leaf/actions/runs/35758716384)
reported twenty-one failures and two errors; nineteen of those node ids
are already repaired on `main` by #930, #917 and #931. This updates the
readings behind the rest, behind two cases those runs never reached,
behind two more that #925 reddened after that run — one of which #917
had just repaired — and behind the receipt element #933 removed while
this branch was open. No runtime code changes.

`main` moved while this branch was open, so it carries a merge of
`f4107f63` and every claim below is against that merge base rather than
the branch's original `26aa5e20`.

## What moved, and what each case reads now

**#936 gave go-to-threads one destination.** `g T` now selects the whole
panel whichever thread the reader stood on to ask for it.
`test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` pressed
it from an inline page thread, expected the matching panel card
selected, and walked back out in two Escapes; it now reads `.lf-threads`
and leaves in one. #936 updated the two navigation cases it could see —
this is the third, in a nightly file its gate does not reach.

**#933 replaced the message receipt with one workflow line.** Nothing
under `skills/leaf/assets/runtime/` writes `.lf-receipt` or
`data-receipt-id` any more: a message's status is the `.lf-msg-sending`
span in its head, labelled by `conversation/workflow.js`'s
`workflowLabel` with the claim detail on `title`. The same
`test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` read
the old element for the root thread on both surfaces and for two later
messages, so after #933 it died there — above the go-to-threads reading
this PR repairs. Each reading now takes the workflow line under the same
head; the identity probes still hold, because the span is retained
across the pickup update on both the inline and panel views.

**#945 made the thread filters toggles rather than one radio group.**
Two cases read the standing status filter with `to_be_checked()`, which
a toggle does not answer, and
`test_inner_state_is_left_before_the_surface_around_it` read the `w`
line as "all threads" where #945 renamed it "clear waiting filter" while
the narrowing stands. Each now reads `aria-pressed` and the current
wording.

**#925 made narrowing retain a card's disclosure.** Its commit message
states it — "Native thread disclosure survives filtering, so an answer
returns where the reader left it unless they selected another
conversation" — and the same commit rewrote `thread-list-view.js`'s
module header to match: "Narrowing retains that disclosure; opening
another named card closes it natively." Two nightly cases press a card's
summary a second time to reopen what the narrowing used to close, so
that press now *closes* an open card:

-
`test_an_ok_on_the_agents_latest_reply_takes_the_thread_out_of_waiting`
presses it after restoring the waiting narrowing, and the reaction chip
under the agent's message is never visible — `Locator.click: Timeout
30000ms exceeded` on `.lf-react[data-token="keep"]`, "element is not
visible". Reading the card's `open` either side of the press: `True`
before, `False` after.
- `test_every_control_the_layer_offers_is_a_box_the_reader_can_hit`
presses it after narrowing to Resolved, so `.lf-reopen` — the one
control that arrangement exists to stand up — reads hidden and the aim
sweep never reaches its own assertion.

Each now asserts the retained disclosure where it used to press for it,
so the contract is stated rather than depended on. A third case in the
same family took the other half of its repair through #955, now on
`main` — see below.

**#932 reset the thread card's inherited top margin and dropped its
chevron column.**
`test_covering_threads_keeps_the_reader_and_their_work_inside` holds the
thread list's raw `scrollTop` equal across the placement crossing, which
reads as the reader's place only while the list can hold that offset at
both placements — a covering sheet's list has a shorter scrollport than
the strip beside the document, so the two have different scroll limits.
With twelve comments the shorter cards left a list whose whole
scrollable range was 63px covering and 17px beside, so the place the
case established sat on the covering limit and the crossing clamped it
to 85 where 131 was recorded. That is Chromium enforcing the lower
limit, not the panel losing the reader's place.

The repair states that premise instead of widening the reading. The
fixture goes from twelve comments to twenty-four, which is what gives
the place headroom at both placements — at twelve the guard fires
immediately, `{'at': 36, 'limit': 36}`. `reading_place()` then takes the
offset together with the list's own limit and fails at the arrangement
unless the offset stands strictly inside it, and each crossing reads it
on the placement it leaves *and* on the one it arrives at, because the
arrival's limit is the one that can clamp. This replaces the
`min(list_at, max_scroll)` clamp #945 put on the same assertion: the
clamp settles the symptom, but it accepts whatever the limit imposes, so
the crossing assertion can no longer fail and the case stops saying what
its docstring says. Bug-backed by forcing a 600px offset before the
second crossing — clear of the covering limit at 617, past the beside
limit at 571 — which now fails at the arrangement (`the list holds no
reading place clear of its limit: {'at': 571, 'limit': 571}`) rather
than as `assert 571 == approx(600)`.

## What this leaves on `main`

- **The quoted passage's shortcut line is the third retained-disclosure
case, and #955 supplied its other half.**
`test_a_comments_quoted_passage_is_in_the_keyboard_journey` pressed the
card's summary after narrowing to Resolved on a 390px sheet, so —
exactly as in the reactions and aim cases above — the press shut a card
the narrowing kept open, the quote lost its box, and its command scope
left the shortcut bar with it. This branch carries that case's
`aria-pressed` hunk; #955 (`fc9d316e`) states the disclosure thirty
lines away in the same function. Neither takes it green alone, and with
both in it passes.
- **#948's strip regression is fixed on `main` by #954** (`13e84e14`).
`test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` — the
reader landing three paragraphs back when the strip arrives — passes
there. Nothing here touches it. #952 tracks both cases with the
per-commit evidence; its remaining half closes when this branch lands.
- **#933's other stale receipt readings are unswept.**
`tests/test_render_startup.py` alone names `.lf-receipt` on twenty-four
lines, mostly as positive readings rather than count-zero guards, and
`test_render_options.py`, `test_render_margin.py`,
`test_render_conversations.py` and `test_render_export.py` carry more.
`test_a_thread_says_what_the_agent_is_doing_about_it` and
`test_a_work_line_says_when_its_claim_has_gone_quiet` both fail on this
branch for the same missing element, and
`test_the_thread_follows_the_decision_that_still_stands` reads the
status filter as `Resolved` where #945 gave it the `Resolved (0)` count
this branch already reads in `test_render_controls.py`. They are the
same class of stale reading as the six here, but a separate sweep in
files this branch does not touch: `main`'s own complete suite on
`f4107f63` is the run that enumerates them, and it was still queued when
this was written.

## Verification

The four touched files run entire on the branch under `--run-nightly`,
on the Linux CI runner, against the branch's own merge base `f4107f63`:
`tests/test_render_anchors.py` at 93 passed, and
`test_render_controls.py`, `test_render_navigation.py` and
`test_render_reactions.py` together at 322 passed with two failures —
`test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` at
`assert 'p8' == 'p11'` and
`test_a_comments_quoted_passage_is_in_the_keyboard_journey` missing
`return to the passage`. `main` has since moved to `13e84e14`, which
settles both: this head merged with it takes those two cases green,
along with
`test_covering_threads_keeps_the_reader_and_their_work_inside`, whose
placement crossings #954's transition reordering could have reached. The
merge is clean. Every case this branch repairs on its own is green, and
nothing else in those four files is stale. `pre-commit` passes on the
changed files.

A pull request runs the everyday gate, which reaches none of these
files, so `ci` here says nothing about them. `main`'s own complete suite
on the merge is the first automatic run that reads them.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 23, 2026
…ed scroll box its tab stop (#962)

`ci` on `main` was red on
[e3cd596](https://github.com/max-sixty/leaf/actions/runs/35777453725)
with eleven nightly failures. Eight of them belong to open or merged
repairs — #951, #954 and #955. This takes the other three, and two of
them turn out to be runtime defects a reader meets rather than stale
readings.

## A keyboard press inside a stroke's claim was eaten

Draw mode holds a claim over every press on the page —
`compatibilityPress` in
`skills/leaf/assets/runtime/composing/drawing.js`, a document-capture
listener that `preventDefault`s and `stopImmediatePropagation`s — so a
stroke lifting over a control does not press that control as well. The
claim is lifted on a zero-delay timer scheduled at `pointerup`, so
*which* press is still a race, and the reader loses it whenever the
release's own work runs long.

The reader who loses it gets nothing and is told nothing. `Ctrl+Enter`
in the composer the stroke had just opened reaches the `text.send`
binding, which calls the Send button's own `click()`; the claim ate it
in the capture phase before any listener on the button ran. Send went on
reading `aria-disabled="false"`, the drawing stayed pending, and no
notice was written. Nothing retries, so the comment was simply lost
until the reader pressed again.

The layer already states the rule this needs, twice: the aim's
`claimPress` lets a click carrying no click count through — "keyboard
activation belongs to the control it is on" — and the selection guard in
`widget-elements.js` spells the same test as `ev.detail === 0`. Draw
mode is the third such claim and had neither. So the reading moves to
one name, `pressIsKeyboardActivation` in `runtime/pointer.js`, and all
three press claims read it off that.

## A comment took a scrolling box's tab stop away

`paintReach` lends a scroll box a keyboard stop unless the box already
holds a control of its own — a board is reached through its grips and
needs no stop over the whole thing. The anchor note is not such a
control. It is the one thing the runtime hangs *inside* a block it does
not own: a 1px transparent button that leaves the flow for `position:
fixed` the moment it takes focus, so standing on it scrolls nothing.

#932
([aab2edc](aab2edc))
moved that reading from the one sweep, which ran before any note
existed, to every layout pass, which runs after. From then on a single
comment on a flowchart wider than the window took away the keyboard's
only route to the half hanging off its right edge. The reading now asks
for the box's own controls and passes over the note.

## The filter reading

`test_the_thread_follows_the_decision_that_still_stands` read the status
filter as a bare `Resolved` where #945 gave it a count. The assertions
either side of it already read `Resolved (1)`; this one now reads
`Resolved (0)`, which is what the reject standing means — nothing filed
away as answered.

## Verification

Both runtime repairs are bug-backed by a new case in an existing file,
each failing on `main`'s runtime and passing on this branch:

-
`test_render_drawing.py::test_a_keyboard_send_reaches_send_while_the_stroke_still_owes_its_press`
holds the release's macrotask rather than racing it, so the window the
rule is about is stated rather than waited for. Without the fix: `the
page never sent the drawing the keyboard sent`.
-
`test_render_controls.py::test_a_comment_on_a_scrolling_box_leaves_its_tab_stop_alone`
reads the same box with the note off and on. Without the fix the second
reading is `tabindex="-1"`.

`uv run pytest tests` is 1298 passed with five failures this sandbox
produces on the unchanged tree — `AF_UNIX` and umask limits, in
`test_interact_layer.py`, `test_interact_session.py` and
`test_website_server.py`. `npm run test:runtime` is 43 passed and
`pre-commit` passes on the changed files. Under `--run-nightly`,
`test_render_drawing.py`, `test_render_aim.py` and
`test_render_pages.py` are 136 passed together, `test_render_drafts.py`
is 83 passed, and the three target cases pass on the current merge base.
A pull request's own `ci` reaches none of the nightly cases, so it says
nothing about them.

## What this leaves on `main`

Main has moved well past the run this is against, and its own complete
suite on
[f4107f6](https://github.com/max-sixty/leaf/actions/runs/35780122081)
enumerates what is left once #951 lands: five stale `.lf-receipt`
readings in `test_render_startup.py` and the same element in
`test_render_anchors.py`, which #933 removed in favour of the message
workflow line, plus
`test_render_widgets.py::test_notification_configuration_becomes_a_commentable_local_artifact`.
That sweep is in files this branch does not touch and #951 already names
it.

<details><summary>How the drawing failure was isolated</summary>

It reproduces only when `tests/test_render_drawing.py` runs whole —
three of four runs at `-n0`, never when the case runs alone — and it did
not appear in the previous nightly, which is why it reads as noise until
it is traced. The path, recorded from an instrumented run:

| reading at the press | value |
| --- | --- |
| `text.send` binding ran | yes |
| `sendBtn` connected, not disabled, the document's own | yes |
| `aria-disabled` on Send | `false` |
| click reached a capture listener on the button itself | **no** |
| a second `dispatchEvent(new MouseEvent('click'))` reached it | **no**
|
| `claimDraft` refused | never called |

Two dispatches at the button failing to reach a listener on the button
places the block above it, in the capture phase, which is
`compatibilityPress`. Instrumentation that added a round trip before the
press — a `page.evaluate` of the composer's state — made the run pass,
which is the timer winning the race.

</details>

Co-authored-by: leaf-agent <[email protected]>
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