Repository navigation
Ask a question again in its own thread when the turn-end check repeats it - #5833
Merged
Merged
Conversation
…s it The turn-end check (`src/leaf/clerk.py`) could only open new threads. On 2026-11-11 the user closed a thread asking them to run `/reload-plugins`, having run it in the wrong session; the agent restated the step in chat, and the check opened a second thread on the same subject instead of continuing the first. The fork couldn't have done otherwise: it had no way to ask a question again, and a question whose thread the user closed without replying (status `open`, next actor none) appeared in neither its On Me list nor its answered-or-withdrawn list. The title dedup missed too, since the fork reworded the title. **What the fork sees.** Each page's facts list every question asked in words that On Me no longer holds, by its id, with its thread's title and how it ended: answered, dropped, or closed unanswered. **What it answers.** Each ask carries `again`: the id of the earlier question it asks again, such as a step the user took that didn't work, or empty (`turn-end-check.md`). **What Leaf writes.** An ask naming a question is the agent's message in that question's thread with `obligation: [<id>]`, as `leaf thread reply --obligation <id>` writes one (`thread.ask_again`). The same record stands open again on the new message, so On Me shows one question in its current words rather than two, and the reply reopens a closed thread. An ask Leaf can't put there, as where the thread owes the user a reply, is taken as one naming none. A new question on an old subject still opens a thread of its own. The agent's line says where it went and names the id to withdraw. Behavior change: an ask the fork names as asked again no longer opens a new thread. `test_a_question_asked_again_reopens_its_thread_under_its_id` covers it; the eval gains `turn-end-check/ask-follow-up`, and `ask-step` gains a closed question on another subject as its guardrail.
leaf-agent
previously approved these changes
Nov 11, 2026
The `resolve` handling read "The user closed the thread. You owe no reply there; a to-do you opened on it stays open until you end it." On 2026-11-11 an agent handed that line put its follow-up to a resolved question only in chat instead of asking again in the thread. The handling now says "The user resolved the thread." and leaves what the agent does next to the references: a reply reopens the thread (`threads.md`), and a to-do stays open after the user resolves its thread (`conversation-loop.md`, "Long-running work").
Replayed with the current question, the real turn ends where the title check had fired (2026-11-04, a page whose agent withdrew the check's ask as already asked on the page) found the fork asking the withdrawn question again in a new thread under the same title in 4 of 4 runs. `again` now carries the one case where the check had dropped a legitimate follow-up, so the check stays.
leaf-agent
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the agent restates a question the page already asked, such as a step the user took that didn't work, Leaf's turn-end check (
src/leaf/clerk.py) now asks it again in that question's thread under its own id, asleaf thread reply --obligation <id>does, instead of opening a second thread beside it. The reply reopens the thread if the user had closed it, and On Me shows the one question in its current words.Before this, the check could only open new threads, and it couldn't see a question whose thread the user closed without replying: such a question keeps status
openwith no next actor, so it was in neither the fork's On Me list nor its answered-or-withdrawn list. Now the fork sees every question On Me no longer holds, by id, and each ask can name one asagain(turn-end-check.md). An ask Leaf can't put in that thread, as where the thread owes the user a reply, falls back to the old path. A new question on an old subject still opens its own thread.The agent's side of the same failure is fixed too: the
resolvehandling now says only "The user resolved the thread." Its old "You owe no reply there" is what led the agent to put its follow-up in chat (browser/runtime/kernel-registry.json).The check still skips an ask whose title matches a thread the agent opened to ask something. Replays of the real turns where that had fired found the fork re-asking, under the same title, a question the agent had withdrawn, in 4 of 4 runs; the module header records it.
Max asked for this after the check opened a second thread on the fork-roadmap page for a
/reload-pluginsstep he had closed. Codex reviewed it twice; its findings (ask again under the question's id rather than as a new question; show the fork the question's current words) are folded in.Tests:
test_a_question_asked_again_reopens_its_thread_under_its_id. Evalturn-end-check*with--base: in the newask-follow-upcase, both head runs asked again in the closed thread (one failed the judge on its wording, asking for a reply the agent could check itself), and both base runs failed; every other case passes on both arms. A replay of the real turn end names the closed question in 3 of 3 runs.