Skip to content

Draw what a gesture settles at once, and take every derived fact from the server - #2663

Merged
max-sixty merged 4 commits into
mainfrom
agent-ab457559acc8c5d33
Oct 12, 2026
Merged

max-sixty merged 4 commits into
mainfrom
agent-ab457559acc8c5d33

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The page no longer predicts what a pending thread gesture leaves its thread. Until now the server read a supposed reply, rewrite, resolve, reopen, settling reaction and its undo on every thread (after), and the page drew whose turn the thread was, and which asks the user owed, from the reading of its pending gesture. Every gesture and subject that list missed showed the wrong state until the POST returned, as a widget's ask did when the user replied in its seat. The server usually runs on the user's machine, so the page now waits for its reading instead.

What the user sees. A reply, rewrite or reaction still shows in its thread at once; a resolve or reopen still settles the thread at once, and a turn still reopens a resolved thread; a to-do the user ends, the approval ask, a thread the user opens with words, and the send's own answer on Tasks still change at once. Whose turn a thread is, which asks the user owes, and Questions and its counts change when the server's reading arrives. For that round trip a thread the user just answered reads "On you to answer", with "Sending" in its title, and the user goes with the thread out of "Waiting on you" when the reading lands. A refused send still hands its thread back to the user.

Server. served_state/browser.py drops after, _SUPPOSED and _supposed; _apply_thread_attention sets each thread's attention alone. WorkReading.supposing and its document override go, and served_state/queues.py stops serving held, which only a reopening's prediction read. Without the six supposed readings the state fold is about half as expensive.

Browser. foldThreads (runtime/thread/model.js) folds messages, rewrites, settlement and withdrawn reactions into the served threads and leaves a served thread's attention as served. questionAttention and Thread.owed go from application.ts, and localQueues moves only the items a gesture is about itself.

Protocol. The page protocol moves to 4. Every page vendored at 3 runs a runtime that reads after and held, which the server no longer sends; leaf page init rebuilds it.

Contract. Root AGENTS.md gains "Responsiveness": a gesture shows what it settles by itself in its own turn, derived facts come back with the server's reading, which should be on screen within 100 ms, and where it cannot be, the fix is a faster path rather than a prediction. "The document starts state; the log changes it", skills/leaf/assets/AGENTS.md ("Authoritative projection"), and the banner, Questions panel and workflow headers follow it.

Tests.

  • Deleted with after: test_after_is_what_each_gesture_leaves_the_thread_as_the_log_reads_it, and the application tests that a pending prose reply does not hide a frozen Ask, a reply reopening a thread puts its Ask back at once, a pending resend replaces recovery, and a pending prose answer changes its ask's next actor.
  • Rewritten: the node fold tests hold that a pending reply, rewrite, reaction, undo or settlement leaves a served thread's attention as served while turns and settlement still change resolved; the taken-back-reaction application test now holds Questions as served until the server's reading moves it; queues.test.mjs holds prose sent beside an ask leaving it on Questions while the send joins Tasks; the two Questions journeys in test_render_navigation.py and two status tests in test_render_threads.py read the served state while the send is held and the moved state after.

Latency. On the triage board a comment's server reading reaches the screen in about 80–90 ms. On the corpus page it takes about 1.3 s on both main and this branch (leaf-dev bench-latency, load ~15), though the server's state read there takes 13 ms; a profile puts the time in the page's paint and forced layout. That is a separate change.

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

max-sixty and others added 4 commits October 12, 2026 13:51
… the server

The page no longer predicts what a pending thread gesture leaves its thread.
Until now the server read a supposed reply, rewrite, resolve, reopen,
settling reaction and its undo on every thread (`after`), and the page drew
whose turn the thread was, and which asks the user owed, from the reading of
its pending gesture. Every gesture and subject that list missed showed the
wrong state until the POST returned, as a widget's ask did when the user
replied in its seat. The server usually runs on the user's machine and
answers within 100 ms, so the page now waits for it.

What changes for the user: a reply, rewrite or reaction still shows in its
thread at once, a resolve or reopen still moves the thread at once, and a
turn still reopens a resolved thread. Whose turn the thread is, the Questions
list and its counts, and the thread's place under the "Waiting on you" filter
change when the server's reading of the gesture arrives. A thread the user
opens with words still waits on the agent at once, since it has no log
beyond the gesture. A refused send still hands its thread back to the user.

**Server.** `served_state/browser.py` drops `after`, `_SUPPOSED` and
`_supposed`; `_apply_thread_attention` sets each thread's attention alone.
`WorkReading.supposing` and its `document` override go, and
`served_state/queues.py` stops serving `held`, which only a reopening's
prediction read.

**Browser.** `foldThreads` (`runtime/thread/model.js`) folds messages,
rewrites, settlement and withdrawn reactions into the served threads and
leaves a served thread's attention as served. `questionAttention` and
`Thread.owed` go from `application.ts`, and `localQueues` moves only the
items a gesture is about itself: a to-do the user ends and the approval ask.

**Protocol.** The page protocol moves to 4. Every page vendored at 3 runs a
runtime that reads `after` and `held`, which the server no longer sends;
`leaf page init` rebuilds it.

**Contract.** Root `AGENTS.md` gains "Responsiveness": a gesture shows what
it settles by itself in its own turn, derived facts come back from the
server, and where the server cannot answer within 100 ms the fix is a faster
server rather than a prediction. "The document starts state; the log changes
it" and `skills/leaf/assets/AGENTS.md`, "Authoritative projection", point at
it.

**Tests.** `test_after_is_what_each_gesture_leaves_the_thread_as_the_log_reads_it`
goes with `after`. The node fold tests now hold that a pending reply,
rewrite, reaction, undo or settlement leaves a served thread's attention as
served while settlement and turns still change `resolved`. The application
tests that asserted a pending reply handing its thread to the agent, a
reopening giving an Ask back, a taken-back reaction reopening its ask, a
pending resend replacing recovery, and a prose reply taking its ask off the
user now assert the served reading stands until the server answers, then
moves with it, and `queues.test.mjs` holds prose sent beside an ask leaving
it on Questions while the send joins Tasks. The two Questions journeys in
`test_render_navigation.py` see the reply join Tasks as it is sent and leave
the user's count once the server reads it. In `test_render_threads.py`, a
thread's status reads "On you to answer · Sending" (or "resend") while the
user's answer is in flight, and the user goes with the thread out of
"Waiting on you" when the reading arrives rather than when they press Send.

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

The banner, Questions panel and workflow headers still described the
handover the previous commit removed, and the Responsiveness section now
states 100 ms as a budget for the reading reaching the screen.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	build/browser/application.test.mjs
#	skills/leaf/scripts/leaf/served_state/queues.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 PR's latency measurement reports about 1.3 seconds for a comment's server reading to reach the screen on the corpus page. With this change, a reply there leaves the thread saying “On you to answer” and keeps its ask in Questions for that interval, even though the reply is already visible and sending. The new Responsiveness contract calls for the reading to appear within 100 ms and says to speed up a path that cannot meet it. That known page misses the bound by an order of magnitude on the exact transition this PR moves to the server; the paint path needs to meet the bound before this behavior is ready to land. I could not rerun the latency benchmark in this CI sandbox because its Chrome launch fails, so the number here is the PR's reported measurement.

@max-sixty

Copy link
Copy Markdown
Owner Author

@leaf-agent Max has seen the corpus number and chose to land this now. Main is no faster there: the server's reading takes the same ~1.3 s to reach the screen on the corpus page today, and prediction only masked it for the gestures after listed. Typical pages are within the budget (triage board: ~80–90 ms). The Responsiveness section's remedy for a path that misses 100 ms is to make that path faster, and a separate session is doing that for the corpus page now: benchmarking the gesture-to-screen time there, attributing it, and cutting it. The server is not the bottleneck (13 ms for its state read on that page); a profile puts the time in the page's presence paint, repaint pass and forced style and layout. Please re-review with that in mind.

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

@leaf-agent

Copy link
Copy Markdown
Collaborator

I’ve re-evaluated my latency concern with the maintainer’s decision to land this change while the corpus paint path is improved separately. That concern no longer blocks this PR. I found no further blocker in the current diff, and the test check passed on 4380d7417d859b7cd0bead3588dd2ff6f0cf144f.

The head already carries my earlier COMMENTED review, so this run cannot submit a second review or a bot approval on the same commit. A maintainer can make the landing decision from here.

@max-sixty
max-sixty merged commit e320d0a into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-ab457559acc8c5d33 branch October 12, 2026 21:59
max-sixty added a commit that referenced this pull request Oct 12, 2026
main's #2663 drops the served `after` readings, so the publisher test this
branch rewrote to read a supposed reply goes with the others #2663 deleted,
and so does the served reading it consumed. The model tests read the open
asks whose next move is the agent's from the ask inventory, since `held` is
no longer served.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
…2677)

A comment on an open ask left the ask on Questions while the comment's
reply stood on Tasks, so one item showed as owed by both sides. An open
ask now has the agent as its next actor while the agent owes a reply
about it: it leaves Questions until the agent answers, still open and
unanswered, its controls live.

- **Page asks** go to the agent while an open thread awaits the agent
and is anchored inside the ask's widget, or inside its framing
`x-question-context` and no other ask (`questions.sections_with_agent`,
`questions.discussed`). A note on one option leaves a framed sibling
with the user; a note on the frame's heading covers all of them.
- **Widgets frozen into a thread** go to the agent once the user writes
after the message that asked, until the agent answers that turn.

This generalizes the seat-only rule (`seat_with_agent` and
`seats_with_agent`, both deleted), which stopped reaching any shipped
widget when 292de9c took `x-thread-seat` off `lf-options`. It reverses
the decision `events.md` recorded, that an open widget ask keeps its
thread awaiting the user after later prose. That paragraph, the
`x-awaits` contract and the glossary now state the new rule.

The browser takes the change from the server's reading, as #2663 has it
take every derived fact, so Questions moves when the reading of the
comment or reply arrives.

> _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 13, 2026
#2712)

The macOS thread appearance gate
(`tests/*/test_render_thread_snapshots.py`) failed on main because two
landed changes altered what the thread journey draws. This re-accepts
the 48 images (leaf-assets `d5c8b46`) after reviewing every one against
the old references.

- #2700 labels the user's messages "Me" instead of "You": every case and
stage.
- #2663 stopped the browser predicting a thread's attention while a
reply is sending. During the send the panel title now reads the thread's
opening words, and "Generating title" appears once the server's reading
arrives (`accepted` still shows it). Affects the `pending`,
`retry-pending` and `newer-draft-pending` stages of `panel`,
`panel-dark` and `panel-narrow`.

Every other differing pixel is antialiasing of at most 6/255 on editor
borders and the check mark, which the comparison already ignores. No
geometry reading changed. `uv run pytest -n0
tests/*/test_render_thread_snapshots.py` passes on macOS against the new
pin.

> _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 13, 2026
Skips the macOS thread appearance gate's message-delivery journey and
its acceptance test to save test time while development moves fast. The
references drifted twice unnoticed (#2663, #2700) because only a manual
macOS run compares them.

Until it resumes, nothing tests the thread's appearance across the
delivery journey, nor, in the nightly Linux run, that journey's delivery
assertions (first insertion, refusal feedback, restored draft). The
comparator's model tests and the Linux font test still run, and
`leaf-dev thread-snapshots capture` still runs the journey, since the
skip applies only without `--image-snapshot-update`.

`TODO.md`, "Resume the thread appearance gate", records how to turn it
back on, including making landing run the comparison so it cannot drift
again. `/developing-leaf` no longer asks for a snapshot run before
landing.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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