Repository navigation
Leave a thread summary standing when the user edits or takes back a message it folds - #6947
Merged
Merged
Conversation
…essage it folds Before, the user's edit of a message under a summary, an undo of that edit, or a take-back of any message the thread held when the summary was written retired the summary, so the thread showed the originals again. The agent's own edit already left its summary standing, with `thread edit` naming the summary. Now every edit and take-back leaves the summary as written, and the agent judges whether it still holds. The edit reaches the agent with the words it replaced (`was`), beside the thread's summaries in force and the messages each folds, and `threads.md` asks the agent to summarize the range again where the change alters what the summary reports. A summary still drops when a message bounding its range leaves the thread, since its range no longer resolves. `events.active_summaries` loses its tracking of the user's edits and take-backs. The summary fork's fence keeps working through it, now refusing only a fork whose summary a later one replaced. Max asked for this on the judgment-survey-misses Leaf page, on the condition that it simplifies. Across the 424 page logs on his machine, 80 summaries and 24 user edits never met, and no user took back a message, so the rule had never fired. Tests: the fold tests now check that a summary stands through the user's rewrite, and the test of a reaction's take-back retiring a summary is gone. The hint tests that used a retired summary to leave a run in full now have the agent keep that run in full. The fork test of an edit dropping its summary is gone. The browser test of a root checkpoint retracted under the reader now retracts it with a replacing summary, and the overlap test no longer ends with a rewrite.
leaf-agent
previously approved these changes
Nov 24, 2026
Now that the user's rewrite or deletion of a folded message leaves its summary standing, the edit's handling says so: where a summary in the thread's `summaries` lists the message in its `covers`, the thread shows that summary in the message's place, and the agent summarizes the range again if the change alters what the summary reports. The clause rides every user edit in a thread that holds a summary, and the agent reads `covers` to tell whether it applies. The rewrite clause's "the thread shows only the new" stays true of an unfolded message. Without it, only the closing paragraph of threads.md, "Summarize a long discussion", carried the rule. Scored on a new eval case, a summary saying the user picked beta over the user's rewrite to stable: a session reading the delivery cold summarized again in every run, 3 of 3 without the clause and 5 of 5 with it, but a session acting an hour in without rereading the references summarized again 0 of 3 times without the clause, saying in its reply only that the summary was out of date, and 5 of 5 with it. The controls, a typo fix the summary still reports, left the summary standing 10 of 10 with the clause, cold and mid-session. The case `thread-summary-after-a-rewrite` holds the primary context, the mid-session one and both typo controls; its envelopes are frozen deliveries built through the admission door. The layer contract's table gains a summarized-thread rewrite, so the new clause reaches a case.
leaf-agent
approved these changes
Nov 24, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 24, 2026
…t by its source text (#6987) `test_sample_browser_boundary_contains_focus_scroll_and_parent_access` has failed on main since #6951 (`fb8b0cc1e7`): it passes at that commit's parent and fails from it on. #6951 made `Element.prototype.scrollIntoView` Leaf's wrap around the browser's method in every Leaf document, a live sample's included, and the test asserted that the method's source text reads `[native code]`. What that assertion stood for still holds: a reveal a sample's script makes itself does what the browser's does. The test now makes that call and checks what it moves, which is the sample's own page and, through the sample's frame, the page around it. Leaf's own `scrollIntoView` leaves the page around the sample still, as the test already checked. `focus` keeps its source-text check, since nothing wraps it. No runtime code changes. To weigh: the new check relies on the browser scrolling the host page for a reveal made inside a sandboxed frame, as Chromium and Firefox both do today. `module-scroll-and-motion.md` already says that Leaf's `scrollIntoView`, unlike the native one, stays inside a live sample. The session running the package-interface redesign asked for this, after an agent found six browser tests failing on main. This is the only one of the six that a pull request of the redesign caused; the others trace to #6796, #6947 and #6009 and are left alone. Max hasn't read the diff. Tests: the test by node id in Chromium, also under `--cpu-throttle 8`, and its body in Firefox with the fixture swapped by hand. It fails when the wrap drops the browser's call, and when the script's call is swapped for Leaf's contained one. > _This was written by Claude Code on behalf of max-sixty_
This was referenced Nov 24, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 24, 2026
…essage it folds (#6991) `test_a_summary_folds_its_messages_where_they_stand` has failed on main in Chromium and WebKit since #6947 (`481e14069`), which made a user's edit of a message under a thread summary leave the summary standing, with the agent deciding whether to summarize again. #6947 updated two other browser tests for that rule but not this one, whose last step still expected the user's rewrite to retract the checkpoint (`Locator expected to have count '0'`, actual 1, in [run 45337874948](https://github.com/max-sixty/leaf/actions/runs/45337874948)). This keeps #6947's intent and changes only the test. The step now checks what the rewrite still owes a user standing on the summary's toggle: the new words draw at once, no notice holds them back, the message's frame keeps its loaded document, and the checkpoint stays. The docstring drops the retraction. No product code changes. Both parametrizations fail on main at `a0d859a5b` and pass with this change. Refs #6989 — automated triage Co-authored-by: leaf-agent <[email protected]>
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 user edits or takes back a message under a thread summary, the summary now stays as written, and the agent decides whether it still holds. Before, Leaf's code retired the summary, so the thread unfolded. The agent's own edit already worked this way.
events.active_summariesloses its tracking of the user's edits and take-backs, and the summary fork's fence follows without its own change.The agent learns of the edit through the delivery: the replaced words (
was), the thread's summaries in force with the messages each folds (covers), and a new handling clause on the user's edit in a thread that holds a summary, which says the summary shows in the message's place and asks the agent to summarize its range again if the change alters what it reports.threads.mdstates the same rule for edits from either side. A summary still drops when a message bounding its range is taken back, since its range no longer resolves.The clause is scored by a new eval case,
thread-summary-after-a-rewrite: a summary saying the user picked beta, over the user's rewrite to stable. A session acting an hour in without rereading the references summarized again 0/3 without the clause and 5/5 with it; a session reading cold did 3/3 and 5/5. The typo controls left a still-correct summary standing 10/10.What to weigh: if an agent misses the clause, the fold shows its earlier account of words the user changed until it rewrites it. Across the 424 page logs on Max's machine, none of the 24 user edits touched a summarized message.
Max asked for this on a Leaf page, on the condition that it simplifies. Code: −21 net in
src/leaf/, +12 in the kernel registry for the clause; tests −75 net, of which +59 is a regenerated snapshot; the eval case is +743, almost all frozen deliveries.Tests: focused model tests for folds, hints, forks, delivery and the layer contract, and the two changed browser tests by node id.