Skip to content

Keep the turn-end check from asking a choice the agent holds, and let thread create quote words a script draws - #7140

Merged
max-sixty merged 2 commits into
mainfrom
turn-end-dup-and-quote
Nov 25, 2026
Merged

max-sixty merged 2 commits into
mainfrom
turn-end-dup-and-quote

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Fixes two defects one session hit on its page.

The turn-end check opened duplicate threads. The user answered a choice with a question of their own. That hands the choice to the agent until it answers, so On Me listed nothing and the fork's page facts showed the choice nowhere. When the agent restated the choice in chat, the fork asked it again in a new thread. page_facts now shows the fork each question still open while the agent holds it, and tells the fork to ask none of them again. It drops the user's own messages from the questions the fork may ask again, and lists every question an On Me row holds. Where an ask names a question whose thread still owes the user a reply, Leaf now tells the agent to reply there rather than opening a new thread. Replayed from that page's log, the facts at all three turn ends now hold the open choice.

leaf thread create --quote refused words a page's script draws, though the user can comment on them in the browser. Where the file's reading lacks the quote, the command now opens the revision in the host's browser. There it finds the quote as the page's search does, then captures and re-resolves its anchor as a selection's would be (render-checks/quote.js, render_gate/drawn_anchor.py). This runs outside the page lease. The retry sits in cli.py because the import order puts the render gate above leaf.thread.

To weigh: thread reply --quote and the turn-end check's passage still find quotes only in the file. A quote the file holds but a script then replaces is still accepted.

Max asked for both fixes and the merge. Evals: in turn-end-check/ask-held, the new case, base asks again 4 of 4 times and head 0 of 7. The other ask cases are level within noise. Tests: a new clerk test, and the new browser test run by node id.

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

… thread create quote words a script draws

Two defects one session hit on its page.

The turn-end check opened duplicate threads. The user answered a choice
in a thread with a question of their own, which hands the choice to the
agent until it answers, so On Me listed nothing and the fork's page
facts showed the choice nowhere. When the agent restated the choice in
chat, the fork asked it again, and Leaf opened a second thread on it; at
a later turn end the fork asked it once more in the duplicate the agent
had resolved, reopening it. The facts also listed the user's own
message, an update record, among the questions the page had asked, under
the `message:` id the fork then gave as the question it asked again.
`page_facts` now shows each question the agent asked that still stands
while its next move is the agent's, in a block telling the fork to ask
none of them again, lists only the agent's own questions among those it
may ask again, and lists every question an On Me row holds, where it
listed only the first of a thread's. Where an ask names a question whose
thread still owes the user a reply, Leaf now posts nothing and tells the
agent to reply there, since the question is On Me again once it does; it
used to open a new thread. Replayed from that page's log, the facts at
each of the three turn ends now hold the open choice and no longer hold
the user's message. `turn-end-check.md` and the eval rubric say an ask
is named only where no On Me item or still-open question holds it. A new
eval case, `turn-end-check/ask-held`, has the agent restate a choice the
user answered with a question.

`leaf thread create --quote` refused words a page's own script draws,
such as a custom element that fills itself in, though the user can
comment on those words in the browser: the command found quotes only in
the file's reading of the page. Where that reading lacks the quote, the
command now serves the revision, opens it in the host's browser, finds
the quote as a stored anchor is found and captures its anchor as the
user's selection of it would be (`render-checks/quote.js`,
`render_gate/drawn_anchor.py`), outside the page's lease. It searches as
the page's own search does (`pageMatches`), within `--section` where one
is named, and draws the page in the reader's window and engine with
held-back work started, as the render check does. Words the drawn page
doesn't show once, a host without a browser and a page that doesn't
start leave the file's refusal standing. The retry sits in the CLI
command because the render gate stands above `leaf.thread` in the import
order. `thread reply --quote`, which moves a thread, and the turn-end
check's `passage` still find quotes only in the file, and a quote the
file holds but a script replaces is still accepted.

`leaf-dev eval run 'turn-end-check*' --base`: 22 of 24 cases pass on
each arm. Repeated: `ask-held`, the new case, passes 0 of 4 on base,
which asks the choice again in a new thread, and 7 of 7 here;
`ask-on-me` passes 7 of 7 here and 4 of 4 on base; `ask-answered` 6 of 7
here and 4 of 4 on base; `ask-follow-up` 7 of 9 here and 8 of 9 on base,
each miss an extra finding beside the right ask, which the judge
faulted. Tests: the new clerk test and
`test_a_quote_of_words_a_script_draws_anchors_where_the_page_draws_them`.

> _This was written by Claude Code on behalf of max-sixty_
…k can't follow its path to the runtime

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit 6285516 into main Nov 25, 2026
6 checks passed
@max-sixty
max-sixty deleted the turn-end-dup-and-quote branch November 25, 2026 08:40
max-sixty added a commit that referenced this pull request Nov 25, 2026
`leaf thread create --section <visual> --part <id>` admitted any id its
visual's declaration admits by prefix, so a thread on `node:nope` in a
diagram was posted and drew no marker, against root `AGENTS.md`'s rule
that Python never accepts an anchor the rendered page can't resolve. The
command now checks the id against what the page drew of that visual:

- a part the visual drew is taken;
- one it didn't, on a visual that puts such a thread on the whole visual
(a timeline, a trace: `drawsAbsentParts`), is taken with a note saying
so;
- one it didn't, on a visual that would show the thread nowhere (a
diagram), is refused. The refusal lists the parts it drew and says that
leaving out `--part` puts the thread on the whole visual, so the agent
can always post.

What the page drew comes from the render reading `page state` already
lists parts from (#7109), now keeping `{parts, whole}` per visual. Where
no reading holds the live version, as right after a save, the command
draws the page once outside the lease, as `--quote` does since #7140.
Where no browser can draw it, the id passes with a note that it went
unchecked.

To weigh: READING's shape changed, so the page protocol moves 56 → 57. A
visual that lists no parts and doesn't draw absent ones is refused,
which goes one step past the rule Max chose. `thread reply --part` still
takes any declared id.

Max chose this design on the issue
([comment](#7039 (comment))).
Tests: `drawn_part` per branch and the CLI against a stored reading and
with no browser (model tier), the drawing path on a real diagram and
timeline (browser tier), and the help regtest.

Closes #7039

> _This was written by Claude Code on behalf of max-sixty_
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