Repository navigation
Let a user rewrite a sent message in place - #2300
Merged
Merged
Conversation
A double click on one of the user's own messages, its Edit control, or ↑ in the thread's empty reply box opens its words in place. Enter saves; Escape leaves the message as it was. The `edit` kind now admits the user's rewrite through POST /api/event, and one admission gate, moved out of `leaf thread edit`, refuses a rewrite of another writer's words or of a message with no text. A user's edit is a turn: `events.exchange` places it among the thread's messages under its own id, so it reopens a resolved thread and owes an answer addressed to the message it rewrote, and its delivery carries `was`, the wording it replaced. Workflows name the message an input shows on (`message`), which the browser reads instead of `input`. The rewrite is a draft under `edit:<message id>`, so its words survive a re-render, a reload and a refusal, and every view of the message shows the open editor. Tests: the server round trip's refusal case names an unknown message, since the browser may now edit the user's own words; two fold tests and one contract test make the edited messages agent-authored with a session, as the door now requires. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rds on Escape An open editor is disclosure, so it is this document's state, held by the view the user opened it in and handed to the next view of the message once that one goes. Another view of the message, and another tab, keep drawing the message as it reads: opening the editor in the Threads panel no longer swaps the words in a page seat for a taller box nobody asked for there. Escape now closes the editor and keeps its words for the next opening, as every other box keeps a draft; Cancel discards them. A closed editor gives up its draft subscription and keys at once. The fold keeps each user revision's `was`, the words it replaced, and delivery reads it there rather than walking the log a second time. The Edit control stands after the message's meta rather than at the head's end, where a margin card's own controls stand. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A question is answered by the user's words standing after it, so a rewrite of a message before the agent's `--awaits` question no longer takes that question off the user's queue: the thread is theirs to answer and the agent's to answer the rewrite at once. `events.message_turns` is that reading, which `asks` and `tasks` take. An open editor whose view goes is handed only to the next view of the message on the same surface, so a panel card hidden by a find no longer swaps the page seat's words for an editor, and a refusal reopens the editor only where its view still stands. The Edit control stays at the head's end, where it holds still while the receipt beside it changes its words. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A thread waiting on the user's answer protects the message that asks from folding into a summary. It read the thread's last turn, which a rewrite since names no message by; it now reads the last message (`events.message_turns`). The gallery's walkthrough says what Escape and Cancel now do. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A suggestion's handling says to apply its words verbatim or say why not, and a rewrite of one arrived as a plain `edit` that said neither. Its delivery now carries `suggestion`, and the edit's handling repeats that rule for it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The delivery folded every thread's messages into a set to learn whether a revised message was a suggestion, which the message's logged event already says. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…turn it is `conversation_turns` had come to include the user's revisions, whose ids name no message, so each caller that reads turns as messages had to be found and switched; the summary hint was missed and offered the newest user message, once rewritten, for folding. Now `conversation_turns` is messages again, and `exchange` adds the revisions only where whose turn it is gets decided: `unanswered_turns` and a failed response's input. `message_turns`, the old reading under a new name, is gone. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`foldThreads` took one list per gesture kind and applied them kind by kind, so a pending rewrite and a pending reply, or a resolve and a rewrite, folded in an order the log never would: the thread waited on the rewrite when the log's response address is the newer reply, and a rewrite after a resolve drew the thread closed where the log reopens it. It now takes the ledger's thread gestures as one ordered list and folds each kind where it falls, as `events.build_threads` folds the log. A ledger entry carries what it draws in a thread as one record, and `isTurnEvent` / `turnMessage` say which gestures hand a thread to the agent and which message they show on, in place of a `message` and an `edit` slot each branch tested. A rewrite of a thread being settled sends nothing, as a reply to it doesn't. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Escape closes a rewrite and keeps its words, but Resume writing (`g i`) had no route to them and said the writing place was unavailable. A thread's own destination now reveals every draft a thread view holds: its reply box, and a rewrite, which opens on its message where the thread lands. The rewrite's draft moves to `rewrite:` from `edit:`, which `lf-draft`'s editor already keys its drafts by, and a thread holding kept rewrite words counts as holding a draft, as one with reply words does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Escape closes a rewrite and keeps its words, but an open card then showed the message as it was with nothing saying the words were kept: the thread's draft marker stands only on a folded card. The message's header now says "unsaved edit" until Save or Cancel settles them. Opening a rewrite no longer writes the message's own words as a draft, so opening and closing one unchanged keeps nothing. The runtime test drops a resolve-then-rewrite order, which the settling guard keeps the page from sending. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/thread/thread-list-view.js
The label read the draft only when the card happened to repaint, so another tab's Escape or Cancel left it stale, and a rewrite closed with the message's own words kept a draft that said nothing new. Each editable message now watches its rewrite's draft and repaints when whether it holds kept words changes, and Escape keeps words only where they differ from the message, as Save sends only then. Since #1918 put a thread's notice beside its first message's header, Tab from a thread whose first message is the user's meets that message's Edit control before the notice, the order they stand in; the held-reply read-state test walks both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
As a Tab stop, a message's Edit control came first in every thread the user had opened, since the thread's notice and Resolve now stand beside the first message's header and follow the transcript in the DOM: Tab then Enter opened a rewrite where it had resolved the thread. Edit is now for a pointer or a finger only. The keyboard reaches every message with ↑: from the empty reply box, the user's latest, and from the start of an open rewrite, their message before it. The held-reply read-state test goes back to Tab reaching the notice first. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The rewrite's ↑ read the caret after the text field's own ↑ had already moved it to the start from anywhere on the first line, so one ↑ in a one-line rewrite left it. The editor now notes where the caret stood as the key goes down. The walk also passes over a message of the user's with no words, such as a bare drawing, rather than stopping there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/composing/input.js
Held news (`gesturedOn`) matched a pending gesture to a thread by its own list of fields — the gesture's attempt, id, parent, rewritten message, or held widget — beside the publisher's `threadOfEntry`, which answered the same question for recovery and local workflows by kind. The two drifted: each new gesture kind needed a clause in both, and the list grew one patch at a time (#1550, #1738, #1835). A rewrite was the latest, held behind its thread's notice as another tab's news until its list learned `message`. The publisher now answers for every kind the ledger holds — messages, reactions, rewrites, settlements, undos and moves on frozen widgets — and publishes the threads they stand in as `thread.gestured`; `gesturedOn` reads it. Recovery keeps to the sends and moves a Retry answers. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Edit control sat inside the header, pushed to its end, so the thread's notice, which #1918 places after the header's last item, began past it: on a panel-narrowed diff seat the notice stood under the open panel, out of reach. Edit is now the user's message control on the reaction trigger's mechanism, an icon anchored to the header's right edge, outside the header's words, whose room the header keeps. Under a finger every message's head holds that row from its first paint, so a message the log admits, which only then offers a rewrite, grows no taller. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The reaction trigger and the Edit control were one mechanism spelled twice, and the touch floor's list named only the trigger: under a finger Edit stood at 26px beside a 44px Resolve. Both now carry `lf-msg-control`, which owns placement at the header's edge, face, reveal and the room the header keeps, and which the aim floor names, so a next per-message control joins them by its class. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # build/browser/generated/browser-runtime.js.map # build/browser/generated/browser-runtime.manifest.json # skills/leaf/assets/vendor/browser-runtime.js
Opening a rewrite with ↑ swapped the message for a bordered field with Cancel on a row of its own, pushing every turn and the reply box below it down 55px, and every way out landed on the thread rather than back in the reply box ↑ came from. A survey of the editor found 41 more problems; this fixes those that follow from how it was built, keeping it over the message as the user chose. - Geometry: the field takes no room around the words, its box is painted around them, and Cancel and Save stand at the message's head as words where its Edit control stood, so opening and closing it moves nothing and a line wraps where it wrapped. A reflow the user asks for holds no extent (`requested` on a thread's repaint), so no gap stays behind. A suggestion's body keeps no markup whitespace. - Landing: the editor is a rung below the thread's reply box; Escape, Enter and Cancel hand the user to that box, or onto the thread where it shows none. ↑ to an earlier message opens it without landing first, Escape on the editor's own controls closes it rather than the panel, and opening reveals the message, unfolding a summary that holds it. - Wiring: the reply box's growth-following treats a box in the transcript as its own writing area (it threw on every keystroke in a margin card), a double click clears the word it selected before the editor sets its caret, an empty or unchanged rewrite keeps nothing, another tab's cleared draft shows the message's words, a rewrite dims on the shared delay, a thread holds one open editor, and the message stops saying "unsaved edit" while its rewrite is sending. - Versions: an edit names its `base`, the revision its words were written over, and the door refuses it once another tab has rewritten the message since, instead of letting a stale tab silently replace it. Opening a rewrite is acting in the thread, so its held news shows first. A refusal keeps the words as an unsaved edit beside the message as it now stands rather than reopening over it. Text the message already says is refused. - Reading: the message's `edited` carries the words it replaced (`was`), which its edited mark's title and the agent's thread state show; held news counts a rewrite as "message edited" rather than a new reply. An empty reply box's line offers ↑ in place of the send key it cannot use. Behaviour that moved in tests: Escape from a rewrite now stands in the reply box, so the rewrite test presses Escape again before `g i`; an agent's edit held behind a notice reads "1 message edited". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The rewrite scenario now says that nothing around the message moves, that Cancel and Save take its header, that every way out returns to the reply box, and that the edited mark's tooltip gives the words it replaced. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The user chose that Escape discards a rewrite's changed words, as Cancel does and as Slack, Discord and Telegram do, so one Escape undoes the ↑ that opened it (the survey page's Ask, 2026-10-06). Words a rewrite still holds when the page goes, or that a refusal gives back, still wait as an unsaved edit. TODO.md records their suggestion of a way back, such as `g D`. A verification pass over the survey found what the first round left or broke: - Under a finger a message's head took its height from the room Cancel and Save need across, growing a non-first message's head to 120px. The room is its own token (`--lf-msg-control-room`) and the head keeps its row. - An open rewrite counted as acting in its thread, so an agent's reply arriving while the user typed was drawn at once and moved the reply box with no input. It waits behind the notice again; opening a rewrite still shows what the thread holds. - A saved rewrite drew its old words for a frame between the box and the new ones, and the thread held that height, so the reply box jumped twice. The send's own paint now closes the editor, and a thread with a rewrite open holds no extent, its box growing and shrinking with the typing as the reply box does. - The head shows the author alone while a rewrite is open, so Cancel and Save, now sized to their words, no longer squeeze it; the box's ring is drawn inside it, which a margin card's transcript clipped, and reaches the reply box's own edges. - A long message's box is no longer capped at half the window. - Resume writing lands on the rewritten message itself in the Threads panel rather than on its thread, whose landing on its latest turn took the view away. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A second verification pass found two more: - Resume writing returned to a rewrite Escape had just discarded, reopening it on the message's own words ahead of the reply the user had been writing. The place written in is now a short history: a rewrite discarded or saved hands Resume writing back to the place before it (`forgetWritingPlace`). - A message taller than its scroller opened its rewrite with the caret far below the view, since the field's lines take their height only as it draws them. Opening now reveals the box's foot, where the caret stands, and follows the box's size until the user does anything; a reply row pinned at the scroller's foot is cleared too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…drop A code review of the editor fixes found these, each confirmed by a probe: - Releasing a thread's held room whenever a rewrite opened or closed let go of room news had left, moving the message being rewritten by 105px, and draft news from another tab released and re-held it in one task. ReplyContinuity now follows the height change of the box the user writes in, the reply row or a message being rewritten, on each native edit and on the presentation that opens, closes or saves a rewrite; the `requested` and `rewriting` releases are gone. - ↑ from the start of a changed rewrite, and opening another in the thread, closed it as Escape does and dropped the words. Changed words now hold ↑ for the caret, as a reply box holding words does, and stay open when another rewrite opens beside them; each editor is named for its message. - Typing in a long rewrite on the page aimed a landing at the whole box on every key. A box in the transcript leaves its caret to the field (`followBoxGrowth`). - A rewrite over one of the tab's own edits still sending named it by its pending id and was refused. The ledger names it by the log's id once answered, as it does a pending parent, and the door's attempt clause is gone. - Kept words now carry the revision they were written over; reopening them over a message that changed since says what it says now. - Resume writing's earlier places survive a reload, and a forgotten place hands back to the latest earlier one still holding words. - The pinned prettier hook's formatting, and a test that could not fail (it now reloads over an emptied rewrite rather than pressing Escape). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The review of the previous fix found that with a changed rewrite left open higher in a thread, saving a shorter one below followed the open one, not the saved one: the reply box jumped back and the room the shorter words gave back stayed as a gap. The held extent now follows every rewrite open in the thread, and writes once, after the follow. A closing editor stops mirroring its draft, which a save settles and which refilled the box with the message's old words just before the paint that took it away. Words kept over the user's own edit still sending no longer report the message as changed by someone else on reopening. The seat case of the rewrite test now also saves with Enter, which no test did on a page thread. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Held news has counted a rewritten message as "message edited" rather than a new reply since the rewrite fixes; the root-summary test still named the old label. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/thread/reply-continuity.js
The merge of main left the committed bundle built from the branch's application.ts before main's changes joined it, which the bundle check refuses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The log reads a rewrite as a turn the agent owes, but not as an answer to a question the agent asked after the rewritten message (`events.exchange`), so a thread whose agent's words or frozen widget ask the user something stays with them. The page's own fold of the pending rewrite handed the thread to the agent, so the Threads filter counts flickered from You to Agent and back until the log answered. The fold now leaves a thread waiting on the user's answer there. A page Ask seated in the thread does go to the agent on a rewrite, and the fold, which cannot tell that Ask from the others, now holds it on the user until the log answers, as it already does for a reply. The rewrite header also names the keyboard route to a rewrite in a resolved thread: Enter reopens it into its reply box, as replying there starts, and ↑ goes on. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A reply under "Waiting on you", or a rewrite under Resolved, takes its thread out of the panel's view: the card held for the words in flight, then left once the log answered, and the user's focus fell to the list. Reopen alone carried them into the open thread. Now every turn of the user's own in a panel thread does (the user's decision, 2026-10-07, #46 on the rewrite survey): where the view leaves the thread out, it widens to one that holds it, and the user lands as that turn lands, a reply on the thread and a rewrite or Reopen in its reply box. A refusal puts the view back only where that view shows the thread again, so a later reply of theirs keeps it shown. Resolve still moves the user to the neighbouring card. Two causes underneath. Arriving at a thread chose a view only when its card was hidden, so a card the view merely kept, for words in flight or news, looked shown and no view was chosen; the narrowing now answers whether the view leaves a thread out (`excludesThread`) and the landing asks it. And Reopen's landing was the only one that went with the thread; `#goWithThread` is now the one for every turn, and `landGesture`, taken out of `settleThread`, runs it for a reply and a rewrite too. The reply test that asserted the drop onto the list now asserts the user goes with the thread, as does the Waiting-on-you tail of the prose-Ask test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/thread/thread-list-view.js
…cted Review of the landing rule found two breaks of the user's decision (#46). Reaching a card news kept in a view it no longer belonged to, as Next unread does, switched the whole panel to that thread's lifecycle, since the narrowing called any card it left out excluded; and a refused turn put its view back after the user had typed in the thread, since only focus, not the view, waited on their input. An arrival now chooses a view only for a hidden card or one the list keeps for the user's own words on their way (`keepsForWords`, the list's `keeping` reading), so a card held for news stays where it stands; the narrowing's own `excludesThread` and the page outline `leaf.js` passed it for that are gone. Words the user sends in a card news kept make that card theirs, so the turn takes them with the thread there too, while a reaction, which sends no words, leaves it held for the news. A refusal's reversal, view and focus alike, now runs only while the landing's own lease on the user's intent holds. Tests: the refused Reopen in `test_panel_settlement_moves_focus_with_optimistic_state_and_restores_a_refusal`, and the reply under "Waiting on you" in `test_the_panel_can_show_only_what_is_waiting_on_the_user` and `test_a_harness_failure_receipt_does_not_read_as_an_answer`, now assert the user's rule. `test_a_thread_walk_card_leaves_and_returns_with_its_anchor` follows whichever thread the walk reaches first, which the gallery's rewrite sample changed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rived view Two follow-ups to the landing rule. A card news kept became the user's own when any gesture of theirs was in flight while any words stood in it, so an unsent reply draft plus a reaction made it "draft" for good: deleting the draft then took the card away under the user, and reaching it chose another view. It now yields only to a reply or rewrite of theirs on its way, which the thread draws as a pending message or pending new words. And a turn whose arrival failed after it had changed the view left a refusal nothing to put back, since the lease that gates the reversal was taken only on arrival (`test_a_failed_reopen_reveal_still_processes_its_durable_answer`). Until the user arrives with the thread, the gesture's own lease stands for them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main (#2020) lets any agent session revise an agent's message, so a successor can correct what a predecessor said. This branch had moved the edit rules from `cmd_edit` into admission (`event_contracts._edit_error`), so the merge keeps that home and drops its session-ownership check there; the author check stays. shadow.css: main gave `.lf-thread-notice` buttons the aim floor; this branch had renamed `.lf-react-trigger` into the shared `.lf-msg-control`. Both kept. The browser bundle is rebuilt from the merged sources. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main's #1994 keeps every facet group shown in every view, so the refusal's return no longer redraws the filter rows; the test now waits past the input window and holds the shift watch over the return. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s kind A resolved card a reply box still holds open, as a refused rewrite or reopen leaves one, drew Reopen as its word in the head's controls row. The head reserves the room of one icon control there, so the word ran left over the opening message's pencil (or an agent message's reaction trigger), and swapping Resolve's check for it moved the row by the difference. The face now follows the place: the panel's resolved title keeps its header label, a row of the settlement's own (a resolved page or outlet thread, a margin card's controls) keeps the word, and the head's controls row always draws the check, as it already did for a card held for news. The reading no longer carries an `icon` flag. Test: a refused rewrite under Resolved keeps the pencil clear of Reopen, under the shift watch. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…face Where a thread's Resolve or Reopen stands (the panel title, a margin card's controls, a resolved thread's own row, or the head's controls row) was decided by three separate conditions, and its face by a fourth over the same inputs; the word-in-the-head overlap was those disagreeing. `settlementPlace` now decides it once in `present()`, and the container and the face both follow from it. The rule that draws a check standing as Reopen as done (ok ink, tint disc) lived in chrome.css's `.lf-chrome` scope, so a page seat drew the same check as a bordered ink button that read as Resolve. It moves to shadow.css beside Resolve's glyph rules, which now cover Reopen's check too, with a deeper disc on hover since the rest state is already tinted. The predecessor-edit test's docstring now says what main's #2020 made it assert. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
events.md: main's reply row (`leaf response reply`) and its first-naming `title` bullet, beside the branch's edit row and user-edit bullets, which now state main's agent rule: an agent may revise a predecessor session's words. workflows.py, served_state/thread.py: main moved these onto the shared work reading; the branch's `exchange` and `turn_message` imports are kept for its edit turns. TODO.md keeps both sides' items; the browser bundle is rebuilt from the merged sources. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main's #2025 retired `leaf thread reply --for` for answers; the rewrite tests now answer by the reference the real delivery prints, which addresses the edit and its rewritten message as before. The event-instruction snapshot takes main's new answering text for the edit case. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main's #2025 delivers an answer as a `ref` the agent answers with `leaf response reply`, so both cases' envelopes are re-frozen from a log built through the append door and the Claude Code prompt hook, and their regexes grade the edit's ref. An ephemeral line alone no longer counts as the answer. The answered case's rubric accepts an answer that asks for the launch date, which the prompt never gives; it had failed a Codex sample for withholding a fact it could not know. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # build/browser/generated/browser-runtime.js.map # build/browser/generated/browser-runtime.manifest.json # skills/leaf/assets/vendor/browser-runtime.js
# Conflicts: # skills/leaf/assets/runtime/marks.css # skills/leaf/assets/runtime/thread/held-news.js # skills/leaf/assets/runtime/thread/thread-list-view.js # skills/leaf/assets/shadow.css # skills/leaf/assets/vendor/browser-runtime.js # skills/leaf/scripts/leaf/delivery.py # skills/leaf/scripts/leaf/events.py # skills/leaf/scripts/leaf/served_state/thread.py # tests/test_render_threads.py
The rewrite's ↑ walks to the user's earlier message only from the start of the box, and the text field's own ↑ has already moved the caret there from anywhere on a first line by the time the key's row is asked. The editor read the caret through private keydown and keyup listeners on its field, which main's register test now refuses: a key enters the runtime only through the register. focus.js, which already reads every input at window capture, now notes the caret in each box a key goes down in, for that key's dispatch, and `caretAtKey` hands it to a row's `when`. The editor's listeners are gone. The walk test also holds ↑ down, which stops at the box's start since the register runs no row on a repeat. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…eft behind Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # build/browser/application.ts # examples/developer/feature-gallery.jsonl # skills/leaf/assets/leaf.js # skills/leaf/assets/runtime/application.js # skills/leaf/assets/runtime/chrome.css # skills/leaf/assets/runtime/focus.js # skills/leaf/assets/runtime/pending/model.js # skills/leaf/assets/runtime/thread/destination.js # skills/leaf/assets/runtime/thread/messages.js # skills/leaf/assets/runtime/thread/model.js # skills/leaf/assets/runtime/thread/replies.js # skills/leaf/assets/runtime/thread/thread-card.js # skills/leaf/assets/shadow.css # skills/leaf/assets/vendor/browser-runtime/application.js # skills/leaf/scripts/leaf/events.md # tests/runtime/queues.test.mjs # tests/served_records.json
Main gave a message's words a block of their own, padded in a margin card to the response control's height, and a card holding a comment just sent keeps those words clear of Send. Each rule named `.lf-msg-text` alone, so a rewrite opened in a card lost the padding and moved its message 11px, and one opened on a comment just sent wrapped wider than the words it replaced. The words and the rewrite standing in their place now share each rule. A new test opens a rewrite on a comment just sent, at desktop and under a finger; without the card rule the touch case fails. A kept rewrite resumes (`g i`) in Threads, which seats its editor, rather than in a primary reader drawing the message on its own, which offers no rewrite. Main's walk-and-resize navigation test pinned the gallery's first thread; the branch's rewrite thread now comes first, so it walks to the thread it is about. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…lling its box The comment-frame rule that keeps a just-sent comment's words in the draft's viewport gave the rewrite standing in their place the same max-height and overflow, which clipped the frame and focus ring the rewrite draws around itself, and the last-line room for Send never reached it. The rewrite now keeps only the words' end padding, grows with its words, and takes the last-line room through the field's own end room. The test also checks nothing clips the rewrite. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main's primary-reader test held an agent's edit and a new reply and read the notice as "2 new replies". Held news on this branch counts a rewritten message as edited, not as a new reply, so the notice reads "1 new reply · 1 message edited". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 10, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
A rewrite that changes only leading or trailing whitespace is discarded as “No change to save.” That changes the exact replacement text of a suggestion, while the event admission contract treats the two strings as different revisions. The editor should compare the full input with the message's full text when deciding whether the rewrite changed.
The editor compared trimmed words with the message's, so a rewrite adding a suggestion's trailing newline, or any edge space, closed as "No change to save" while it sent the untrimmed words otherwise. One rule now decides no change, for saving and for putting a rewrite aside: the exact words the message says, or none. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 10, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 11, 2026
PR #2300 made ArrowUp in an empty reply box edit the user's last message. The shortcut bar deliberately shows that live command in the Send hint's place until the box has content, while the old test expected Send immediately on focus. The test now checks the empty-box edit hint, writes a reply, and checks that Send and the way back appear for a draft. `test_the_key_line_keeps_local_and_page_hints_and_progressively_reveals_the_rest` failed on the stale Send expectation in [main CI run 38085674297](https://github.com/max-sixty/leaf/actions/runs/38085674297). The full browser journey passes with both states exercised (`1 passed`). Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
… each message's change once (#2491) Follow-ups to #2294, which draws an open progress group's border around its messages so an answer folding the progress a reader is on moves none of their words. **A margin card clipped that border and could scroll sideways.** The border overhangs the transcript's end by 6px. In the Threads panel that lands in the card's inset, but a margin card's transcript scrolls, so the overhang cut off the border's right edge and let the card scroll 6px sideways (measured at 390px: `scrollWidth` 316 against `clientWidth` 310). The overhang is now one token, `--lf-group-ring-end`, which the border reads and the margin card's transcript takes as room from the card's inset (`annotation-chrome.css`), so the words keep their width and the transcript no longer scrolls sideways. **Held news names each message's change once.** `difference()` in `thread/held-news.js` read a message's change through three overlapping tests that #2294 (streaming) and #2300 (rewrites) each extended. `messageChange` now returns `joined`, `completed`, `rewritten` or `grew`, and the loop counts from that. The notices are unchanged. **The stability contract matches the code.** `skills/leaf/assets/AGENTS.md` said an answer folding the progress at a thread's end may move that progress; since #2294 a run on screen stays open where it stood and one off screen folds away. Runtime tests (350), the notice and fold browser tests (106), the margin card tests (282) and the thread appearance snapshots pass locally. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[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.
A user can now rewrite a message they sent, in place, on every thread surface: the Threads panel, a thread seated on the page, and the margin card. The rewrite is a turn the agent owes an answer to, so it reaches the agent like a reply, while every surface shows it as the message's new wording rather than a message beside it.
What the user does
.lf-msg-control).g i(Resume writing) reopens.How it works
event_contracts.py,events.py,events.md,registry.json):editis admitted from the browser with the revision it was written over (base), and refused once another tab has rewritten the message since. Any agent session may edit an agent message; no agent may edit the user's words.build_threadskeeps the user's edits asrevisions, andexchange()puts them in turn order, sounanswered_turnsandworkflowssee the agent owes the rewrite an answer, while what the thread says and what a question waits on still read the messages.delivery.py,workflows.py): an envelope carries the edit'swasand ananswer.refaddressed to the edit; the agent answers it withleaf response reply. The handling text tells the agent to say what the rewrite changes and to retitle the thread when the first message's rewrite no longer fits the title (scored by the twoevals/user-rewrite-*cases).build/browser/application.ts,runtime/thread/model.js): the ledger handsfoldThreadsits thread gestures in the order the user made them, so a rewrite, a reply and a settlement fold as the log will. A workflow names themessageit shows on, so a rewrite's receipt stands on the rewritten message.runtime/thread/message-edit.js,messages.js,thread-card.js): one editor per message across surfaces, keyed by message, wired to the shared draft store and key register. A turn that takes its card out of the panel's current filter carries the user with the thread and back on refusal (#speak).build/browser/event-types.mjs): the generator now strips server-owned fields from every branch of a record, not only its top level. The edit record's per-author branches had putauthorback into every browser command type.Testing
Browser tests for each path are in
tests/test_render_threads.py(open/close geometry on all three surfaces, the keyboard walk, refusals under the Resolved filter, two rewrites at once, a rewrite under a finger, a rewrite of a comment just sent); CLI and server behaviour intest_interact_product.pyandtest_interact_contract.py; the ledger fold intests/runtime/thread-workflow.test.mjs. The browser failures that remain in the branch's test files also fail onmain.Left open
g iresumes such a rewrite in Threads.