Skip to content

Let a reply that answers nothing, a later --done, and any session's to-do end go in - #6271

Merged
max-sixty merged 4 commits into
mainfrom
refusals-that-second-guess
Nov 17, 2026
Merged

max-sixty merged 4 commits into
mainfrom
refusals-that-second-guess

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Three refusals that stopped a reasonable agent write now let it in and say what it did, as Max picked on the survey of refusals that second-guess agents:

  • A reply by message id into a thread that owes an answer posts, with advice naming what's still owed (owed-response becomes advice). A --ephemeral progress line on a stale reference posts too, taking nothing in hand (superseded-progress advice keeps the old refusal's news, such as a withdrawn note). A stale reference on an actual answer is still refused, so an unread newer message can't show as answered. progress-parent, the same progress case at another door, is deleted as unreachable.
  • A CLI answer's retry key covers the whole write, so --todo and then --done on one reference both go in (redeclared-answer deleted). The --done reply posts in the thread without answering anything, and Leaf names the to-do the earlier answer opened that's still open, for leaf task end. Ending it automatically was tried and dropped: the reply and the end were two appends, and a retry after a failure between them left the to-do open for good. A reworded retry is now refused as already answered, where it used to return the first reply silently.
  • Any agent session may end any open to-do (todo-execution deleted).

Production code is −29 lines (−42 counting code alone); tests −24. Shipped prose (threads.md, conversation-loop.md) is corrected for facts only. Independent of #6246 and #6218; no schema change.

Tests: 11 focused tests/model files (788 passed) and the reply-guidance regtests. Codex reviewed the first version; its two findings are fixed in the second commit.

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

…o-do end go in

Four refusals second-guessed agent choices that break no guarantee. Each now
goes in, and where the outcome may surprise, the command notes what it did
beside the record.

- A reply by message id into a thread that owes the user an answer posts
  (was `owed-response`, an error). It answers nothing, so the update stays
  owed, and an advice finding under the same code names the command that
  answers it. The turn-end clerk still asks no question again in such a
  thread (`thread.ask_again`).
- `--ephemeral` progress on a reference that no longer names the owed update
  posts in the thread, taking nothing in hand (was `superseded-reply`). The
  `superseded-progress` advice carries what the log now holds the event as,
  such as the user having resolved the thread. An answer on such a reference
  is still refused, since it would mark an unread newer message answered.
  `progress-parent`, the append door's second check of a progress line's
  parent, could no longer fire and is deleted: `post_reply` is the only
  writer of a reply's `start`, and writes one only under the parent of an
  update the same reading found owed.
- A CLI answer's retry key hashes the whole write (reference, words and
  options), not the reference alone, so `--todo` and then `--done` on one
  reference both go in (was `redeclared-answer`, deleted). The `--done`
  answer finds the update already settled by the earlier answer, whose
  to-do is still open, so it posts in the thread without `responds`,
  appends a `todo_end` (done, detail "reply <id>") and notes
  `todo-delivered`. An identical retry still returns the first reply; a
  reworded one is its own write, refused as `superseded-reply` once the
  update is answered.
- Any agent session may end any open to-do, by `leaf task end` or a stamp's
  `--completes` (was `todo-execution`, deleted). The rule only made another
  session start the to-do first.

Tests changed with the behavior: the owed-thread refusal tests in
test_responses, test_interact_anchors, test_forks and the reply-guidance
regtest now assert the post and its note; the race test in test_todos asserts
stale progress posts without a start; reworded-retry tests now retry word for
word, and a reworded answer is refused; a new test covers --todo then --done;
the session-authority to-do tests become one test that a session neither
opening nor starting a to-do ends it, and a stamp ends to-dos another session
started.

No event schema changes, so no protocol bump.
A `--done` answer to an update whose earlier `--todo` answer left a to-do
open no longer appends a `todo_end` beside its reply. The two were separate
appends, so a failed second append left a reply that an identical retry
returns (`_repeated_reply`) and a to-do nothing would ever end. The reply
still posts in the thread without `responds`, and the command now notes
`promised-todo` (was `todo-delivered`): the earlier answer whose to-do is
still open, and the `leaf task end` that ends it. `_Obligation.ends` and the
`_promised` helper go with it.

Shipped prose: threads.md now says a message posted by page and message id
answers nothing, so an answer its thread owes stays owed, and that a later
`--done` on a `--todo` answer's reference posts its reply while Leaf names
the to-do still open. Docstrings that said a stale reference refuses every
write now say it refuses an answer, with the exceptions `post_reply` names.

@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 new todos.py header records the date of the decision and the rule it replaced. Root AGENTS.md, "Where instructions live", puts both in the commit message, and keeps in a header the decision itself, whether the user made it, and why the alternative fails. A rewording is inline. Nothing else in the change needs a change.

Comment thread src/leaf/todos.py Resolved
@max-sixty
max-sixty merged commit 23fdd3f into main Nov 17, 2026
5 checks passed
@max-sixty
max-sixty deleted the refusals-that-second-guess branch November 17, 2026 16:49
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