Repository navigation
Stream a Codex reply into the open thread card instead of holding it behind "1 new reply" - #2294
Merged
Merged
Conversation
…"1 new reply" On a real Codex App Server turn the Threads card drew an empty agent bubble when the turn opened its reply seat, held the opening's first streamed words as an edit of that bubble behind "1 new reply", and kept them there until the user pressed the notice. When the agent answered with `leaf response reply`, the answer's retry key differed from the placeholder's delivery attempt, so the bubble vanished and a new message was appended — under a hold, out from under the notice that protected it. Three causes, fixed where each lives: - The server projects a provisional reply only once it has words (`served_state/thread.py`). Before then the input's workflow already says Replying; the empty bubble was the defect #947 chased, not an indicator anyone chose. - A provisional reply and the agent's answer to the same input share one name, `response:<input>`, which the server stamps on both (`_response_key`) and the browser's new `messageKey` (thread/model.js) reads before attempt and id. The explicit reply keeps its own `leaf-response-` attempt, so #2085's guarantee that an author's retry key never consumes the provider final's append identity stands. A failure receipt is no answer and keeps its own name. - Held news (`thread/held-news.js`, `difference`) treats words joining the reply still streaming at the thread's end, and the answer completing it, as that reply arriving: growth at the end, which an idle open card streams and a held card counts once. A changed body on any other message is an edit ("1 message edited"), and a turn of the user's own, from another tab or a mirror that drew late, is "1 new message". A held card keeps a streaming reply that went away drawn until its news shows. Behavior the tests now hold: - `test_a_codex_reply_streams_into_an_open_card_and_its_answer_completes_it` (new): no agent bubble before words, the opening streams with no notice, and an explicit answer completes the same element. Red on main (an empty bubble drawn). - `test_a_held_card_counts_a_streaming_reply_once_and_names_the_users_own_message` (new): one reply however often its words grow, and the user's own turn named as a message. Red on main ("2 new replies"). - `test_a_durable_reply_completes_its_stream_placeholder_in_place` (was `..._an_empty_stream_placeholder`): seeds a placeholder with words; the answer now shows as it lands rather than behind a notice, and the later edit reads "1 message edited". Red on main. - `test_a_durable_answer_retires_the_placeholder_its_attempt_reserved`: seeds words; still proves an answer naming only the attempt retires the draft. - Notice wording in five existing tests: agent and user edits now read "message edited", the user's own late-drawn turns "new message"; the hosted website turn streams its opening words before the receipt-beside-news checks, since an empty seat no longer draws. - `tests/served_records.json` regenerated: served agent answers carry `key`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ugh a send
Review of the streaming-reply fix found held news recognising the stream by a body
change at the transcript's end rather than by the fact that the message is
provisional, which went wrong three ways:
- A held answer was relabelled "1 message edited" on the next reading: `withheld`
drew the durable answer under the streamed words without its provisional fact,
so the following comparison read a durable message whose words had changed.
`withheld` now keeps the drawn message's `provisional`.
- An answer that repeats the words it streamed, as an App Server final does, never
counted as the reply's arrival, so the progress it folds into Previous updates
read as "1 summary changed". A message drawn provisional is now the reply arriving
whether it grew or completed, and its fold is that reply's news ("1 new reply").
- The user's reply sent while the agent streamed drew below the stream and, once
accepted, above it, since the server stands the live reply after every logged
message: the stream jumped 69px with no input. The pending message now joins the
thread above a trailing provisional reply (`foldThreads`), where the log will take
that reply's answer, so neither the acceptance nor the answer moves it.
The streaming message grows in place inside the transcript's `append` region, which
promised no change to existing messages. `skills/leaf/assets/AGENTS.md` now lets a
last message marked `data-lf-streaming` change at its foot, `MessageView` writes the
mark, and the shift watch admits that growth (`appendGrowth`) and nothing else.
`thread.is_answer` is now the one predicate for an agent's answer to an input;
`successful_replies` and the served answer key read it. `workflows.py`'s map of each
input's latest response keeps its own test: it counts failure receipts too, to find
the inputs whose response failed, which is not the answer predicate.
Tests (tests/test_render_threads.py), red on the previous commit's source:
- `test_a_held_card_counts_a_streaming_reply_once_and_names_the_users_own_message`
now draws the stream idle, holds the card, grows the stream twice and completes it
with an explicit answer, then adds the user's message from another tab. Red: the
later reading said "1 message edited · 1 new message". The previous commit claimed
it was red on main for counting; it was red there only on the user's message label,
since main also counted one growing message once.
- `test_a_reply_sent_while_the_agent_streams_moves_nothing_when_accepted` (new,
watch_shifts): red, the shift watch caught the reply moving 69px without input.
- `test_an_answer_completing_its_stream_with_the_same_words_folds_progress_as_its_own`
(new): red, "1 summary changed".
An idle open card still holds an answer whose arrival folds earlier progress, as it
did for every answer before streaming: collapsing that progress changes messages the
reader may be on, which the append region does not permit.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…pen card Since #1926 an agent's first move on a comment is an ephemeral acknowledgement, so nearly every answer folds progress into Previous updates. Held news treated that fold as a change to existing messages, so an idle open card held almost every answer behind "1 new reply" for every harness, the symptom #22 fixed for streaming. Held news (`thread/held-news.js`, `difference`) now reports a `footFold`: every summary that comes is triggered by a message arriving in this reading, none goes, and what they cover is the run of drawn messages just before that arrival. An idle open card (`thread-card.js`, `newsMoves`) shows that fold with the answer, as it shows an append, unless the user stands on a message the fold puts away, which stays held as before (`test_ephemeral_progress_folds_when_its_held_completion_is_revealed`). A held card still counts it once, as "1 new reply". `skills/leaf/assets/AGENTS.md` and the module header record the allowance beside the streaming one. The shift watch needs no rule for either allowance: main's `appendGrowth` already admits a streaming last message growing and an answer folding the progress run at the foot, under both motion preferences, while it still flags a 60px change above them. The streaming exception the previous commit added there was never reached, so `tests/shift_watch.js` returns to main's, and the `data-lf-streaming` mark it read is gone. Tests (tests/test_render_threads.py): - `test_an_idle_card_shows_an_answer_folding_the_progress_at_its_end` (new, watched, with and without a stream before the answer): no notice, the answer drawn, the fold standing, and the thread's opening message where it stood. Red on the previous commit: the answer was held. - `test_an_answer_completing_its_stream_with_the_same_words_folds_progress_as_its_own` now holds the card by writing in it, since an idle card shows the fold; it still proves the held notice reads "1 new reply". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ut's first answer Final review of the streaming-reply and progress-fold commits: - A reader stands on a message by a selection as surely as by focus. The fold that puts away the progress at a thread's end checked focus alone, so a selection in that progress was destroyed with no notice. `focus.js` now reads standing once: `standingNode` (focus, else the end of a selection the user drew) and `standsOn` (that, or a selection reaching into the node). `newsMoves` holds the fold where the reader stands on a message it puts away, and `HeldArrivals` keeps a margin card the reader stands in by the same reading, which also read focus alone. - Two agent answers to one input, which the log can hold though no writer gives one, were both drawn as `response:<input>`, so a card's keyed transcript rewrote the same message (`test_margin_card_holds_its_top_as_a_turn_arrives_and_as_a_reply_wraps` failed on unchanged writes since the first #22 commit). Only an input's first answer takes that name now (`_answer_key`); a later one keeps its own. - The held-news header said every existing reading stays protected right after recording the fold decision; it now says what stays protected. Long comment lines rewrapped. - `verify_site_browser.js` reports when the reply's own message came into view (`message`) beside the first sign, and the journey reading carries it as `sinceSendMs.responseMessageVisible`, since a visible row dates a reply a frame before its message does. Not changed: a provider final committing while the user's reply is in flight. The card draws the user's pending message above the streaming reply; the log then holds the answer before the user's message, and the next reading draws it there. Drawing the answer below would disagree with the log and with every later reading, so the one move in that race is the log's order arriving. Tests (tests/test_render_threads.py): - `test_a_selection_in_the_progress_keeps_its_fold_held` (new, from the reviewer's probe): red on the previous commit (no notice, the selection gone), green now. - `test_a_fold_at_the_foot_admits_no_change_above_it` (new, watch_shifts): the opening message moving as an answer folds the progress is still a shift without input, which holds the previous commit's claim about the watch. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tands in Review of the previous commit: - Where the user stands had two owners: `standingPlace` (standing-target.js) read focus, else the selection's focus, while `standingNode` (focus.js) read the same with a different rule. `standingNodes` in focus.js is now the one reading, nearest first: the focused node unless focus rests on the body, then the selection's focus and anchor. `standingPlace` takes the first that is a place on the page, which is what it read before, and `standsOn` asks whether any lies in a node or the selection reaches into it. Both readings already went through `focused`, so a press held on a label stands where it did. `queue-walk.js`'s Done step and `navigation.js`'s reading-block lookup keep their own reads: the first excludes runtime controls standingPlace counts, and the second wants a selection's start inside one reading region. - `HeldArrivals` kept a margin card only where the standing node, which is focus whenever focus is off the body, lay in it, so a selection of the card's words was lost as soon as focus sat on any control. It now keeps every thread any standing node lies in. - An input's first answer, the one that takes `response:<input>`, is now the first in log order rather than in thread iteration; the docstring no longer claims a winner the other readers do not pick. - `await_reply_shown` hears a reply its row or notice showed first for up to two more seconds for its own message's time, so `responseMessageVisible` is set whenever the message comes into view in an open card. Tests: - `test_a_thread_the_agent_starts_on_a_bare_diff_line_waits_at_its_margin_marker` gains `selecting`: a selection of the held card's words, focus on the Threads toggle, the line wheeled away. Red on the previous commit (the thread was released into the diff), green now. - `test_journey`'s browser stub shows the row first and the message a read later; red on the previous journey (`responseMessageVisible` None), green now. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/standing-target.js # skills/leaf/assets/runtime/thread/held-news.js # skills/leaf/assets/runtime/thread/model.js # skills/leaf/scripts/leaf/session-lifetime.md # tests/served_records.json
Main typed the browser's messages (#2187, #2188); the key the server draws an input's answer under and the provisional mark on a streaming reply join those types. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The site checks main added read a reply's shown time without the message time this branch records, and drive the journey's clock with one sample per wait it takes. The journey now takes the message wait's deadline only when the message has yet to show, and those checks expect the message time. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…them #2219 gave an expanded progress group a border with padding inside it, so opening the group moved its messages 13px right and 11px down. When the agent's answer folds the progress run a reader is on, the card keeps that run open in place, and the padding moved the very words being read along with everything below them. The border now stands around the messages in the gaps they already leave, so opening a group, by the user or by the fold, moves none of their words. The group looks the same apart from its messages lining up with the rest of the transcript. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Oct 10, 2026
leaf-agent
reviewed
Oct 10, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
CI found a regression in answer classification: a reply carrying both responds and ephemeral is now treated as a completed answer. The scenario and usability readers then count progress as the final reply (failed test job). The answer predicate needs to exclude progress even when the address is present.
The same job also times out in three package-reading cases looking for the old 2 new replies notice after an edit, and reports two margin-preview shift failures. Those failures still need to be resolved or shown unrelated before this head can merge.
leaf-agent
dismissed
their stale review
October 10, 2026 21:23
CI failed: progress is classified as a completed answer by is_answer.
`is_answer` dropped its progress check on the reading that progress carries no `responds`, which holds only since #1727; a page log written before then addresses progress to its input, and the eval readers grade that shape. Progress is never an answer again. A held edit and a new reply now read "1 new reply · 1 message edited", the notice this branch gives them, where the primary-reader test expected "2 new replies". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Oct 10, 2026
# Conflicts: # skills/leaf/assets/runtime/thread/held-news.js # skills/leaf/assets/runtime/thread/messages.js # skills/leaf/assets/runtime/thread/model.js # tests/test_render_threads.py # tests/test_render_widgets.py
leaf-agent
approved these changes
Oct 10, 2026
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 Codex reply now streams into an open thread card as the agent writes it, and the agent's answer completes that same message in place. Before, an idle open card showed an empty agent bubble behind "1 new reply" until the user pressed it, and held the answer again as an edit.
Since #1926 the agent's first move is a progress acknowledgement, so nearly every answer folds progress or completes a streaming placeholder, and the card's hold on changes to existing messages held almost all of them. Journey runs (#2144) showed the notice on every Codex reply.
What changes
response:<input>(served_state/thread.py). The browser draws a message under that key (messageKey,thread/model.js), so the answer completes the stream rather than arriving as a second message.thread.is_answeris the one rule for what counts as an answer, so a failure receipt keeps its own name; a second answer in the log keeps its own id.thread/held-news.js). Words joining a streaming reply, and its answer completing it, are the reply arriving, not an edit. An answer folding the progress run at the thread's end shows at once in an idle open card (footFold), unless the reader stands in that progress by focus or selection. Notices now say "new reply", "new message" (the user's own, from another tab) or "message edited".focus.js,standingNodes/standsOn): focus, then the selection's ends.standingPlaceand the held-arrival lapse use it.styles/components/surfaces.css). With Contain sample scrolling and refine expanded progress messages #2219's inset padding, the fold above moved the words the reader was on 13px right and 11px down. Its messages now line up with the rest of the transcript; the group otherwise looks as before.responseMessageVisible), apart from its row or notice.Testing
Eight new browser journeys in
tests/test_render_threads.pycover streaming into an open card, a held card counting the stream once, a send during a stream, an answer completing its stream with the same words, the foot fold under the shift watch, a selection holding the fold, and no change above the fold. Runtime tests, the fold-related render tests, and the thread appearance snapshots pass locally. Realcodex-app-server --browserandclaude-code --browserjourneys showed no notice at any step, with the stream visible about 2.1–2.4 s after send.