Repository navigation
Let the agent's thread writes stand, and say what Leaf did with them - #6633
Conversation
Four places where Leaf's code overruled a write the agent made, mostly without telling it, found by the 20 November survey of code that chooses for the agent (#6630). Max picked "Build the four changes in one PR". - A summary's cancellation now follows who changed the thread, not the summary's form. The user's rewrite of a folded message, or their taking back a message the thread held, retires every summary over it, words or label alike; before, a label-only fold survived the same rewrite. The agent's own edit leaves its summary standing, where before fixing a typo in its own message dropped its summary; `thread edit` now names the summary the edited message sits under (`edit-under-summary`). - The turn-end check no longer drops a fork's ask, telling no one, when its title matches any thread the agent opened to ask something. The fork already sees each ended question with its id; the title match only dropped new questions that shared an old one's words. This reverses the decision `clerk.py`'s header stated, which no commit records Max making. - A reply's `--title` on a thread that already has a title now says which title stands and that `leaf thread edit --title` renames it (`title-kept`), where before it was ignored silently. - A to-do's, a reply's `--todo` or a plan step's title over the limit is fitted as a thread title is, with `title-fitted`, rather than refusing the whole reply or plan it rides on. Tests: the fold tests, the summary-hint tests and the browser summary test now retire a summary by the user's rewrite; the clerk tests assert an ask sharing a withdrawn question's title is asked; new tests cover the two new advice findings and title fitting for to-dos and plans. > _This was written by Claude Code on behalf of max-sixty_ Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
When the user has taken back the comment a thread opened on, an agent reply that carries --title now crashes with KeyError instead of being refused. The title-kept lookup in _compose_and_append indexes build_threads(...)[thread_id] before append_admitted runs. build_threads drops a taken-back comment that nothing else stands on, so the lookup raises before admission can return its withdrawn-parent refusal. This is reachable in ordinary use: an agent's first reply often titles the thread, and the user can take the comment back while the agent writes. I reproduced it on this head with leaf thread reply <page> <id> --text … --title … after an undo of the comment: exit 1, KeyError('<id>'). On main, the same command exits 1 with parent '<id>' has been taken back. The suggestion below lets admission refuse as before.
The `title-kept` lookup read the thread before admission, so a reply with --title to a thread whose root the user had taken back raised KeyError instead of the `withdrawn-parent` refusal it gets on main. The lookup now runs after admission, which has refused such a reply, and notes only where the standing title differs from the one the reply carried. The withdrawn-root test now also titles its reply. > _This was written by Claude Code on behalf of max-sixty_ Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ent's edit (#6644) `test_a_summary_folds_its_messages_where_they_stand` failed in both Chromium and WebKit on `main`'s push run [44859344032](https://github.com/max-sixty/leaf/actions/runs/44859344032) (`ffd552baa`). After the agent edited a folded message, it waited for the summary's checkpoint to disappear, but the checkpoint stayed (`Locator expected to have count '0'`, `Actual value: 1`). #6633 meant to change that: now the agent's own edit leaves its summary standing, and only the user's rewrite of a folded message, or their taking back a message, retires it. #6633 updated the summary-overlap test that way but missed this one. Here the edited message is the user's own reply and the user rewrites it. The test still checks what it is for: when a user standing in the thread sees the retraction, it draws at once, the frame keeps its loaded document, and the selection survives. No product code changes. Locally, both parametrizations fail on `main` with the CI assertion and pass on this branch. Refs #6636 Co-authored-by: leaf-agent <[email protected]>
Four places where Leaf's code overruled a write the agent made now let the write stand, and three of them tell the agent what Leaf did. They came out of the survey of code that chooses for the agent (#6630); Max picked "Build the four changes in one PR" on that survey's page.
thread editnames the summary the message sits under (edit-under-summary).clerk.py's header stated, which no commit records Max making.--titleon an already-titled thread now says which title stands and thatleaf thread edit --titlerenames it (title-kept), instead of being ignored.--todoor a plan step's title over 80 characters is fitted as a thread title is (title-fitted), instead of refusing the whole reply or plan.Worth weighing: the summary change still has Leaf retire a summary on the user's rewrite. Deleting the retirement entirely, so the agent re-summarizes after any rewrite it hears about, would remove more code; that isn't what was picked, so it isn't here.
Max asked for this; nobody else has read it. Focused model tests for folds, summary hints, the clerk, to-dos, the interact layer and forks pass, as does the one browser summary test whose fixture changed; pre-commit passes.