Skip to content

List a page's held to-dos in each delivery, so input that ends a wait brings its to-do back - #7312

Merged
max-sixty merged 2 commits into
mainfrom
waiting-on-an-outside-event
Nov 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
waiting-on-an-outside-event

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Each delivery batch now lists the page's open to-dos that name a wait (held: id, text and waiting_on), whatever its input, and an event that owes an answer is told to start such a to-do, as well as the input, where the input frees it. Before this, a to-do held with --waiting-on (#7303) came back only if the agent remembered it: leaf page state carries waiting_on, but agents run it at will (98 of 191 Leaf sessions on this machine last week ran it at all, and about a third of its calls projected obligations away), and nothing Leaf pushes named a held to-do. Max asked for a primitive so the agent needn't remember such work across a long context.

To weigh: Leaf reads nothing from a wait's words, so it lists every held to-do with every batch and the agent judges which input frees one; the clause rides only events that owe an answer, and the reference states the rule for any input. DELIVERY moves to since 59, so pasted eval envelopes read leaf-delivery/59. Also fixes a Codex reply correction that picked the first batch from the page in its delivery, which, after two watch passes while Codex was busy, held another input and so carried no events.

Scored on Claude Code, 3 runs an arm, with the new case held-todo-returns-with-its-input: a Done on the choice the to-do waits on started it 6/6 with this change (two wordings), 0/3 with main, and 0/3 with this change's references but main's delivery; a question elsewhere on the page left it held in all 12 runs.

Tests: the delivery, contract, to-do, hook and Codex App Server model tests, and pnpm run check.

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

… brings its to-do back

A to-do held with `--waiting-on` read Waiting on <what> until the agent started it,
and Leaf reads nothing from the words, so only the agent's memory of earlier turns
brought the work back when the wait ended. `leaf page state` carried `waiting_on`,
but agents run it at will: 98 of 191 Leaf sessions on this machine in the week to
26 Nov ran it at all, and about a third of the 5,300 calls projected `obligations`
away with jq. Nothing Leaf pushes (deliveries, the Stop hook, the turn-end check)
named a held to-do.

Each delivery batch now carries `held`, the page's open to-dos that name a wait (id,
text, waiting_on), whatever its input, since Leaf can't tell which input ends a
wait. A clause under `$events.answering.reply` and `.markup` tells an event that owes
an answer to start such a to-do, as well as the input, where the input frees it, and
to end it with an outcome. DELIVERY moves to since 59, so pasted eval envelopes read
`leaf-delivery/59`.

Scored on Claude Code, 3 runs an arm, with the new case
`held-todo-returns-with-its-input`: a Done on the choice the to-do waits on started
the to-do 6/6 with this change (two wordings) and 0/3 with main's delivery and
instructions, and 0/3 with this change's references but main's delivery; an
unrelated question left it held 9/9 across all three.

A Codex reply correction also picked the first batch from the page in its original
delivery, which, when Codex took two watch passes while busy, held another input,
so the correction carried no events; it now picks the batch holding the input.
Maximilian asked for this after #7303 added `--waiting-on`.
… case

The reference's rule for input that frees a held to-do without owing an answer
named `leaf task start <page> <id>`, which refuses without `--text`. The case's
rubric now also requires the start on the Done event, as the clause asks.
@max-sixty
max-sixty merged commit b007c86 into main Nov 26, 2026
6 checks passed
@max-sixty
max-sixty deleted the waiting-on-an-outside-event branch November 26, 2026 21:51
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