Skip to content

Walk what waits on you with a, and count both queues in the banner - #1745

Merged
max-sixty merged 48 commits into
mainfrom
what-needs-you
Oct 5, 2026
Merged

max-sixty merged 48 commits into
mainfrom
what-needs-you

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

a now pages through everything waiting on the user, not only Asks, and the banner counts both queues: "N on you · M on Claude". This is step 3 of the plan on the design page, notes/what-needs-you/page.html, which this PR also adds. The queue and task code is marked experimental.

The walk

  • a / Shift+a (runtime/queue-walk.js, replacing the Ask walk in asks/view.js) visit, in page order:

    • open Asks;
    • threads whose attention is on the user (a prose question, or a failed send to resend);
    • page widget moves handed back to the user.

    A thread holding an open Ask is visited once, as the Ask.

  • The walk has no arrival of its own. An Ask arrives through the Ask view, a thread through the t walk's arriveAtThread (pulled out of navigation.js), and a widget move through travel. The announcement reads "1 of 2 waiting on you · Thread".

  • t still walks every open thread.

What counts as "on the user"

  • Python's agent_state.queues selects from the served Asks, thread attention, workflows and tasks. It now lists each thread once.
  • runtime/queues.js makes the same selection from the browser's own reading, which already holds the tab's unsent moves. A thread message still sending counts on the agent at once, replacing that thread's owed answer.
  • The browser keeps its own copy of the rule because it reads the Asks of the revision on screen and folds in local sends. tests/served_records.py builds a served state covering every kind, and tests/runtime/queues.test.mjs holds the JS selection equal to Python's.

The banner

  • The status row ends with "N on you · M on Claude" in a box sized for "9 on you · 9 on ", with tabular digits. A count changing moves nothing, and the box only grows.
  • The "waiting", "queued" and "saved" counts move off the row into the details popup. That popup names tasks inside the agent sentence.
  • The counts are their own banner item. On one row nothing else changes. When the banner wraps (below about 794px), the agent's sentence keeps the first row and the counts lead the second, shown only where the controls leave room for them whole, so "Approve version" and the search steps never truncate. While hidden they stay readable in the status disclosure.

Supporting changes

  • materializeAsk is now a synchronous lookup plus an awaited thread build only when the Ask's nodes are missing. Arrival happens in the key's own turn, which Make clock-sensitive checks wait for completed work #1707's stricter typing check requires.
  • tests/input_work_watch.js attributes a Lit update to the input that requested it. An element's first update is dated by its connection, so an element built under a key and connected later doesn't credit that key.
  • One atWork in thread/workflow.js replaces three copies of the stage check.
  • page check --render's Ask screens step past a widget move handed back to the user instead of stopping there, and an a step whose thread arrival newer input cancelled announces nothing.
  • Updated to match: the references (authoring-asks.md, page-authoring.md, packages.md), the registry's x-awaits/x-ask-surface text, the glossary, and the feature gallery and corpus.

Tests

  • New: test_a_walks_what_waits_on_you_and_the_banner_counts_both_queues, the parity tests, and the words-watch cases for Lit updates.
  • Status-text tests now expect the shorter row.
  • Two widget tests that read the scroll mid-glide now wait for it.

Local: npm run test:runtime, npm run test:browser, npm run check:browser, the shift-watch and words-watch suites, and wt hook pre-merge.

🤖 Generated with Claude Code

max-sixty and others added 30 commits September 29, 2026 13:38
Adds notes/what-needs-you: a Leaf page proposing six directions for
tracking what the user owes the agent and what the agent owes the user
(total turn, one queue, loops, a ledger in the page, page rounds, and
review passes), with a recommendation for loops, and research.md holding
the evidence behind it: prior art across review tools, agent harnesses
and the theory of commitments, a hand classification of 169 real Leaf
threads, and each mechanism's falsifier measured on the logs.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Each flow (a background subagent, a dispatch to another session, a mixed
message resolved at once) lists its events and a sequence diagram, then a
tab per model showing what each step leaves on the user's list and the
agent's. Tracing the dispatch showed C's hand-off closed the request and
unblocked its Ask before the result existed, so handing now moves the
request to the receiving session.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The per-model tabs hid the comparison: each flow is now one table at the
available width, a row per event and a column per model, with cells that
lose work or depend on the agent tinted. Below 900px the rows stack, each
cell labelled with its model.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
C's cells said "answer: pulse", after its drawer heading, which read as
something other than the pulse Ask the other columns list.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A wide table names each model's record, where it lives, what counts as on
the user and on the agent, and the verbs each item offers; four JSON tiles
show the query's answer at flow 2, step 6. Today's answer spans asks,
workflows and the browser-only thread attention.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Directions, Flows, What changes and Evidence, with each flow's sequence
diagram folded above its table.

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

Adds a Plan tab proposing Pi Durable's task as the one record behind both
queues (yours and the agent's), shipped in four steps, and rebuilds the
Compare tab around timelines answering: is running work on the agent, what
one item spans across a back-and-forth, and how many items one message makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Adds `leaf task open PAGE THREAD TITLE` and `leaf task end PAGE TASK
done|failed|dropped [DETAIL]`, written as new `task` and `task_end` log
kinds (tasks.py owns the fold, the door's gate and the writers). A task
stands on an open thread until its outcome is written: a reply, a
resolution, a version or the end of the session leave it open, which is
what holds work that outlasts the turn that took it on.

Behavior that moved:
- A thread an open task holds reads `waiting` with reason `task` when no
  workflow holds it; its card reads "Task open", and the margin and Page
  Map carry that label.
- The banner's explanation names every open task, so one on a thread the
  user resolved stays visible.
- `leaf page state` carries each thread's `attention`, the open `tasks`
  (also per thread in `page state PAGE THREAD`), and `queues`:
  `on_you` (open Asks, prose questions, failed responses) and `on_agent`
  (owed answers, claimed work, open tasks), selected from readings the
  served state already makes.
- A waiting card whose attention names no workflow no longer folds its
  status (thread-card.js matched undefined ids).
- conversation-loop.md tells the agent to open a task for work that
  outlasts the turn and end it when the result lands; the new eval case
  task-outlasts-the-turn scored base 0/2, change 2/2 on Claude Code.

Tests that asserted the exact `page state` thread shape now include
`attention`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The page now covers only the task model: what is built, the task record
and its states, the two queues, the cases a task keeps, the evidence
behind it, and an Ask for the next step. The six directions, the B/C/D
comparisons and the prior-art survey are gone from the page;
research.md keeps the research.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The user wants "item" left arbitrary for now, so the page no longer
lists the kinds as a fixed table; it names today's sources and says the
set isn't a contract.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Answers the user's page comments: a table of the five records that hold
someone to something (Ask, prose question, owed reply, claim, task), how
each is registered and what it looks like, how they meet today, and how
Pi Durable separates message delivery from work.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The user set the model in a page thread: an Ask parallel to a task, a
queue each, either side adding to the other's, and a paging through the
user's queue. The plan now runs from that, and the superseded step Ask
is kept settled under finished work.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The banner's explanation switched to a bare count once a third task
opened, so a task on a thread the user had resolved lost the one place
that named it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	notes/what-needs-you/page.html
`a` and Shift+a now page through everything on the user, in page order:
each open Ask, each other thread whose attention is the user's (a question
left in prose, a failed reply to send again), and each page move handed
back to them. A thread holding an open Ask is reached once, as that Ask.
`t` still walks every open thread. The banner's status sentence ends with
"N on you · M on <agent>", and its disclosure names the kinds.

What is on the user has one rule, now stated on both sides of the wire:
`agent_state.queues` selects it from the served Asks, thread attention,
workflows and tasks, and `runtime/queues.js` selects the same items from the
publisher's reading of those four, which already folds this tab's sends into
attention. The publisher carries the result as `effective.queues`.
`served_records.py` folds a reading both selections must agree on, and a
runtime test holds them to it. The Python rule changed to list a thread once:
a thread with a failed reply is one `recovery` item named by the thread, and
a page widget's failed move stays a `recovery` item of its own.

Arrival stays with each item's owner. `queue-walk.js` replaces the Ask walk
(`ask.walk` becomes `queue.walk`): an Ask arrives through the Ask view's
`arriveAtAsk`, the drawer's arrival, and a thread through the arrival the t
walk makes (`navigation.js`, `arriveAtThread`), so a change to where a walked
thread lands applies to both walks. The walk announces "Ask 2 of 3 waiting
on you" or "Thread 1 of 3 waiting on you".

The render gate's Ask screens walk past the threads `a` now stops at.

Behaviour the tests moved:
- The Ask walk's position reads "waiting on you" where it read "open", and
  the command reference names the walk "Ask or thread waiting on you".
- Two narrowing tests press Shift+a: the thread the list shows waits on the
  user too, so the hidden Ask now stands before the user's place.
- Status sentence and disclosure assertions include the queue counts.
- The status-press test grows its sentence to "running tests", since the
  counts now share the row at 390px.
- Two widget tests wait for the arrival's glide before reading where it
  started; they read the scroll mid-glide and failed on main too.

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

Follows the review of the queue walk.

The banner's row gives the agent's side only as the queue count. The
delivery counts ("1 waiting", "1 queued") and "N saved" leave the row; the
disclosure keeps them, and names each open task's title inside the "Waiting on
<agent>" sentence instead of an "Open tasks" one. The counts stand in their own
span after the sentence, inside the same press, at their own width, so a long
sentence truncates before them. The status box declares itself a text reflow
region: the sentence and the counts repack inside it as news rewrites either.
The shift watch let a text region's controls neither grow nor shrink; it now
holds them to what it holds every box to, staying put without being carried,
so a press growing at its trailing edge is allowed and a carried one is not.

A thread message this tab is still sending is an `answer` on the agent's queue,
with no answer named and the stage `sending`, so a reply leaves the user's
count and joins the agent's in the same turn. A widget move still sending
owes nothing yet, and the Ask it answers stays open until the server says so.

The walk's position names its whole list and then the kind it stands on:
"3 of 4 waiting on you · Thread". The command descriptions, the shipped
references and the gallery name the third kind of item, a move to send
again.

`served_records.py` now folds claimed work and a page move whose pickup failed
into the reading both queue selections must agree on; `model_folds.reading`
takes the status store's work claims to do it. The stage check for work under
way has one home, `thread/workflow.js` `atWork`, which the queues, the live
workflow check and the margin's receipt face read. Comments that still named
the Ask walk name the queue walk.

Behaviour the tests moved:
- Status row assertions drop "· N waiting" and "· N saved" and read the counts
  from `.lf-status-queues`; disclosure assertions include the queue sentence.
- The status-press test checks the counts stay whole when the sentence
  truncates at 390px.
- The queue walk test holds the reply's POST and sees both counts move
  before it answers.
- Walk positions read "N of M waiting on you · Ask".

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

The queue counts leave the status press and stand at the trailing edge of the
status room, beside the banner's controls, at their own width. That edge never
moves, so a changing agent sentence cannot carry the counts and a changing
count grows them leftward only, which the stability contract already allows;
the sentence still gives up its room to the ellipsis first. The previous
commit's text reflow region on the status, and the shift watch change it
needed, are gone: the shift watch is as it was on main. Inside the banner's
control row the counts would not fit beside Approval, which leaves about 84px
at 1280px.

test_a_thread_says_what_the_agent_is_doing_about_it has failed since #1694,
which holds news that would move an open short panel thread behind the card's
news notice. The test appended the user's follow-up and the agent's answer
straight to the log, so both waited behind that notice and never drew. The
follow-up is now sent from the card, as the user's own words show at once, and
the test opens the notice for the agent's answer before reading it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/navigation.js
#	skills/leaf/assets/runtime/reading-place.js
#	tests/test_render_startup.py
The queue counts at the status row's trailing edge grew leftward when a
count changed, so their words moved. Chrome reported that as a layout shift,
and the shift watch then audited the whole frame and caught a panel motion it
misses on main: a reaction arriving from another tab grows an open short card
in the Threads panel by 28px (its reaction strip is not held behind the news
notice), and the filter labels widen by 2px. That defect is main's and is left
as it is.

The counts now take the idiom every generated control with changing words
takes (`reserve`, as Threads does for "Threads: 999"): their box keeps the
width of the counts they usually reach, under ten a side, and their words
start at its fixed leading edge. A count changing moves none of them, and a
sentence changing reaches them only as the press's ellipsis.

The status-press test grows its sentence to "testing", which fits beside the
reserved box at 390px.

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

Two narrowing tests failed under the typed-words check from #1707, on main as
well as here: walking to an Ask whose thread a Threads search hides clears the
search, and the check said the words left with no key. Both sides of that were
wrong, and each fix alone leaves the tests red.

The runtime reached the Ask after `await materializeAsk(...)` even when the
Ask's nodes already stood, so the reveal that widens the narrowing, and clears
the search the user typed, ran after a native await, outside the key's turn.
`materializeAsk` now answers at once for an Ask that stands and returns a
promise only when the thread's markup has to be built, so the arrival, and
what it does to the page, is the key's doing in its own turn.

The check's causal tracking did not follow reactive element updates. Lit's
`requestUpdate` defers the update behind a native await, so a Web Awesome
field redrawn for a key, as the Threads search is, lost its cause.
`input_work_watch.js` now records the source of the request that starts an
update and runs `scheduleUpdate` under it, for every element class that
defines Lit's update lifecycle. New tests in `test_render_words_watch.py` hold
a key's deferred update as the key's and keep the same update with no input
behind it a loss.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ve update by its connection

Follows the final review of the queue walk.

A follow-up the user sends in a thread the agent already owes counted as a
second `answer` while its POST was in flight, so "N on Claude" read N+1 and
then N once the server answered: the server owes a thread one answer, to its
latest move. A thread message still being sent now takes the place of the
served answer for its thread in `selectQueues`. The runtime test and the
held-POST browser test both cover the follow-up.

`input_work_watch.js` credited an element's first update to whatever made it,
though Lit holds that update until the element is connected: an element made
under a key and connected by passive work had its first update credited to the
key. Connecting the element now names that update's source. The negative words
test gains that case.

The queue counts' digits are tabular, and their reserved box only grows while
the page is open, so counts past nine a side widen it once instead of moving on
every change. `materializeAsk` is now only the thread materialization, awaited
where an Ask's nodes are missing, beside a synchronous lookup. Comments no
longer place the counts beside the banner's controls: at desktop width they end
the status area, mid-banner.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty and others added 11 commits October 4, 2026 08:18
A new Panel sketches tab holds four candidates to replace the Asks
drawer (two stacked queues, one list filtered by owner, inside the
Threads panel, and lists opened from the banner's counts), beside
today's drawer as a baseline, with an Ask to pick one. The page's
existing content moves into a Model tab.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
They are new and expected to change a lot; the module headers and the
owners list say so, so later changes don't treat their shape as settled.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/navigation.js
# Conflicts:
#	build/browser/generated/browser-runtime.js.map
#	build/browser/generated/browser-runtime.manifest.json
#	skills/leaf/assets/runtime/asks/view.js
#	skills/leaf/assets/vendor/browser-runtime.js

@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 Ask screenshot pass stops before later Asks when the queue first lands on a page widget recovery. STANDING_ITEM recognizes only an Ask or thread, so that widget returns null and _asks_in_turn exits. A page with a failed widget move ahead of an open Ask silently loses the Ask screens that page check --render promises. The walker needs to recognize and advance past the widget stop too.

A cancelled thread arrival still claims a successful a step. In arriveAtThreadById, the awaited arrival's result is discarded and the function returns true. With the panel closed, openPageThread can return null when newer user input cancels its intent; queue-walk.js then announces the thread's ordinal even though focus stayed on the newer input. Propagate the actual arrival result before recording or announcing that step.

max-sixty and others added 3 commits October 4, 2026 13:01
# Conflicts:
#	skills/leaf/assets/runtime/asks/view.js
#	skills/leaf/assets/runtime/navigation.js
…read arrival

The Ask screen pass of `page check --render` presses `a` and reads where it
landed. It knew an Ask and a thread, so a page widget move handed back to the
user, the queue walk's third kind of stop, read as the walk's end: a failed
move ahead of an open Ask lost every Ask screen after it. `STANDING_ITEM` now
reads the page widget holding focus as a stop to step past, and the pass ends
at a stop it has already stood on rather than only at a repeat of the last.
The screens test puts an answered Ask with a failed pickup ahead of the others
and still gets their three screens; it got none before.

`arriveAtThreadById` discarded the arrival's result and returned true, so an
`a` step whose page-thread opening newer focus cancelled still announced the
thread's ordinal. `arriveAtThread` now answers whether the user arrived, with
the press's intent retained before any wait the queue walk makes, which also
stops a panel arrival after a narrowing reveal from taking focus back. A new
navigation test holds the opening, moves focus, and checks focus stays and
no position is announced, with the unheld press as its control.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	build/browser/generated/browser-runtime.js.map
#	build/browser/generated/browser-runtime.manifest.json
#	skills/leaf/assets/runtime/navigation.js
#	skills/leaf/assets/vendor/browser-runtime.js
#	skills/leaf/references/packages.md
leaf-agent
leaf-agent previously approved these changes Oct 4, 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.

The 390px banner truncates an ordinary short status after the new queue count takes its reserved width. In the test job, test_the_status_press_grows_into_free_room_and_moves_nothing[390] fails with only 164px shown for 173px of “Agent working — testing”; I reproduced the same assertion on this head. The status row needs enough room for that sentence alongside the count, or an intentional narrower status contract reflected in the UI and test.

@leaf-agent
leaf-agent dismissed their stale review October 4, 2026 23:47

CI failed: the 390px banner truncates a short status after the queue count reserves room.

max-sixty and others added 3 commits October 4, 2026 17:57
…ond row

The queue counts stood inside the status box, at its trailing edge, in a box
reserved for "9 on you · 9 on <agent>". At 390px the status has a row of its
own, and that reservation took about half of it, leaving the sentence ~178px
("Agent working — running …"). In the one-row band just above the two-row
breakpoint it was worse: at 640px the sentence had 0px, since the theme's 210px
status allowance never counted the counts.

The counts box is now a banner item between the status and the run (the status
view still owns and reserves it). On one row nothing moves: the 1280 layout is
pixel-identical. On two rows the sentence takes the first row whole and the
counts lead the second, under the sentence's start, with the run taking what
they leave. A gesture's steps that stand in the reading loop's place on a
narrow run take the counts' room too (`data-lf-gesture` on the run), since
those steps fill a phone's row. The theme's row allocation adds 11em for the
counts, so the banner wraps below ~794px instead of ~630px and the narrowest
one-row sentence keeps ~157px.

Behavior that moved, and the tests that hold it:
- test_the_status_press_grows_into_free_room_and_moves_nothing now asserts a
  realistic sentence ("running the browser suite") shows whole at 390 and
  1280, that the counts stay whole, inside the banner and clear of the status
  and every control, and watches the counts with the other banner boxes for
  movement.
- test_the_banner_rows_follow_the_window_independently_of_sign_off: a 740px
  landscape phone now takes two rows; 820px keeps one row with and without
  Approval.
- test_banner_status_is_compact_with_accessible_details sums every banner item,
  counts included, against the row.
- At 390 with sign-off, Approval's label truncates ("Approve ver…") to seat the
  counts' reservation; Approval yielding first is its stated contract.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	build/browser/generated/browser-runtime.js.map
#	build/browser/generated/browser-runtime.manifest.json
#	skills/leaf/assets/vendor/browser-runtime.js
…em room

On two rows the counts led the second row and the run took what they left,
so at 390px on a sign-off page Approval truncated to "Approve ver…" to seat the
counts' reserved box. Approval must not truncate for them.

The run is now placed first on the second line, from the trailing edge, at its
controls' full words (flex-basis auto), and the counts follow it on that line
only where they fit whole; otherwise they wrap to a third line that the
banner's stated height (now set on two rows) and its clip do not draw. The
banner lays that line out right to left so the counts still stand at the
row's leading edge, under the sentence. One rule covers Approval and a
gesture's steps alike, so the toolbar's `data-lf-gesture` attribute and its
rule are gone. The counts stay in the status's disclosure meanwhile.

Measured at 14px UI type: with Approval the counts fit beside the run from
about 430px to 480px (narrow faces) and again from about 500px (desk faces);
at 390 they give way.

Behavior that moved, and the tests that hold it:
- test_the_status_press_grows_into_free_room_and_moves_nothing asserts Approval
  shows whole at 390 and 1280, with the counts drawn whole at 1280 and left out
  at 390.
- New test_the_counts_lead_a_phone_s_second_row_where_the_run_leaves_room: at
  390 without sign-off the counts lead the second row under the sentence's
  start, give way to a finger's search steps without clipping them, and return
  to the same place when the search closes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 5, 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.

The CI test job fails at test_the_runtime_tests_build_on_the_records_the_server_serves. The new queues on both sides case in served_records.json lacks rewritten_from: null on its four thread records; the merged server fold now emits that field. I reproduced the equality failure locally. Regenerating with uv run tests/served_records.py and rerunning the test should bring the committed fixture back in sync.

@leaf-agent
leaf-agent dismissed their stale review October 5, 2026 01:46

CI test fails: the new served-records fixture is missing rewritten_from fields.

@max-sixty
max-sixty merged commit c05a828 into main Oct 5, 2026
4 of 5 checks passed
@max-sixty
max-sixty deleted the what-needs-you branch October 5, 2026 02:28
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