Skip to content

fix(chat): keep a reply's footer however its turn ends - #20128

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
hickoxd:fix/turn-footer-after-error
Oct 30, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
hickoxd:fix/turn-footer-after-error

Conversation

@hickoxd

@hickoxd hickoxd commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A reply keeps the line that names the model that served it and the credits it used, and keeps its Copy / Fork / More actions, however its turn ended and whatever is drawn below it (#19855).

#19984 (merged) made the backend stamp meta.turn_stats on every abnormal end. On main today the footer still goes missing in these cases:

  1. An auto-nudge cycle replies after a completed reply. As the cycle's reply streams in, the earlier reply's whole footer disappears and never comes back. The frontend walk that decides whether a reply shows its footer treats only a user row as the end of a turn, so a nudge row followed by its reply hides the footer above it, stats or no stats.
  2. A reply is cut short and a recovery resumes it below (the model at capacity mid-reply, a stall, a lost connection). The backend stamps the cut reply, but the same walk hides its footer the moment the resumed answer is drawn, and until the recovery finishes the page never receives the stamp at all: a queued recovery sends no chat_done, and the stamp rides only that refresh.
  3. The gateway restarts mid-turn. The seam's shutdown save of the cut reply runs before the footer is attached, so the restart shows the reply bare.
  4. The chat window is at its row cap. The attach scans slot.messages[turn_boundary:], and the cap has shifted every index, so the cut reply gets no footer.
  5. A recovery arm ends a turn whose completion reported no billing. The footer takes the completion's empty figures while the usage row is written from the provider's live read, so the two show different credits.
  6. A reply is cut short by an error and resumed in the same turn. In the default collapse-all-steps setting the turn shows its last reply and folds the rest, so the cut half, the start of the answer and the row the footer sits on, folds behind "Worked through N steps" and the reader gets a sentence that starts mid-thought. For a sub-agent synthesis answer the grouper also read the stamped cut half as the end of the answer and folded the resumed half behind the next wave.

One more is robustness: a cancel landing on the seam's shutdown save propagates into the recovery arm that called it and costs that arm its card and its recovery.

Why it matters

The footer is where a person reads what a reply cost and which model wrote it, and its row is where they copy, fork, pin or quote that reply. A chat with an auto-nudge loop armed loses both on every reply before the latest one, and a reply a capacity retry or a stall cut short is often the one a person most wants to copy or fork from, or price.

Not a goal

  • No change to the usage rows a turn writes, their stop_reason, or when they are written; no new rows.
  • No change to which ends stamp a footer: every abnormal end does, since fix(dashboard): keep the reply and its footer when a turn ends abnormally #19984. This changes when the stamp is made, where it lands and how it reaches the page.
  • No stats or time on the error card or the turn-ceiling card itself; the footer lands on the reply row, the same row a completed turn's footer lands on.
  • No footer for a turn that ended before dispatch, or that appended no reply row (a pre-stream transient retry re-runs the same turn and appends none).
  • No change to when a recovery is queued or what it sends, and no change to the time limit, its card or its native stop.
  • No change to how the follow-up option chips pick their reply (Quiet auto-nudge reply clears the previous question's option chips #12934 is that walk's own bug).
  • No live usage while a turn is still running (Main chat: show live token/cost usage while a turn is running #13629).
  • No change to how a completed turn's footer reaches the page (the refresh its chat_done triggers). Which row it lands on changes in two cases: a window at its cap, where the scan from the boundary index missed the reply, and a turn that recorded no reply (a slash command's confirmation is a plain assistant row) whose window took a system notice after that row. A workflow or sub-agent envelope appended after a recorded reply was already passed over on main. The turn's file chips follow the same walk, so the one row they can no longer attach to is a system notice.
  • No change to what the collapse-all setting folds in any other shape: a reply that was never cut, narration before a tool call, and a cut reply without the stamp fold exactly as before; only a stamped reply a recovery row resumed, that row, and the synthesis row directly above the reply (the row the answer's turn opens on, which main shows) are kept out.
  • No cue on a cut-short reply that a recovery continues it below, and no merged footer: each half of a resumed reply draws its own full footer, because the two halves are two usage rows (the cut turn's and the recovery's) and the Goal above promises the actions however the turn ended. A "continued below" marker, a combined cost and an explicit interrupted marker on the cut row are not part of this change, and this PR files no follow-up for them; each is a small change of its own if the owners want it.
  • No new display semantics: an unreported credit or cost figure stays omitted, as on a completed turn.

Backwards compatibility

Compatible. New output: a chat_message_update WS patch carrying meta.turn_stats for a reply an abnormal end stamps (the client already merges that patch into the row's meta; a client that misses it reads the stats from the next refresh); meta.turn_stats in the shutdown save of a cut reply, on the reply in a window at its cap, and with the credits the usage row records on a recovery arm's turn whose completion reported no billing. Existing usage rows, their stop_reason, the cards, and which recoveries are queued are unchanged. A reply that carries stats now keeps its footer in more places (for example a sub-agent wave's per-completion replies, each of which is a completed turn, and in an SDK host such as a side chat or an embed, a stamped last reply while a later run is going, as the chat page already did), never in fewer.

Removes _attach_owned_turn_stats (added by #19984): its one production caller was _attach_turn_stats passing reply_mids=None, and the slot's own _turn_reply_mids is the list it read, so _attach_turn_stats now carries that body itself, including the retries count #21907 added to it (the same keyword at the same call site; the abnormal path records none on main either). No other key, row, route or public function is removed; the two inline footer walks are replaced by one function over the same inputs.

What changed (motivation → approach → change)

Frontend: the footer walk ended the turn at the wrong rows, in two copies. The page's inline IIFE (now in pages/chat/page/transcriptRendering.tsx, where #20388 moved the row) and renderAssistantBubble (app-sdk/messageRenderers.tsx) each walked forward from the reply and returned "no footer" at the next assistant row; the page's copy did so before it read the reply's own turn_stats, and the SDK's never read them. Each treated only a user row as the end of a turn. A nudge / subagent / cron row followed by its reply therefore hid the footer above it, even on a completed reply, and so did the recovered answer under a cut reply. One function, replyShowsFooter (website/src/pages/chat/replyFooter.ts), now decides it for both: a reply carrying positive turn_stats always draws its footer; a reply without stats draws it once a user row or a row that opens a turn of its own (the existing opensTurn predicate) follows, or once the transcript ends and the session is idle. The hidden say-nothing and system-notice skips are kept. Both callers pass the row they draw, and its own role and stats come from that row, as the old walks read the row itself: the page draws a deferred snapshot of its rows while the walk reads the live list, so the list at the row's index can hold another row. A crewmate's chat still forces the footer at a run's end (forceFooter).

Backend: the footer reaches the open page before a recovery runs. A completed turn's footer reaches the page through the refresh its chat_done triggers. An abnormal end that queues a recovery hands the slot to it without one, so the cut reply's footer would only appear once the recovery finished. _broadcast_turn_stats (chat_turn/turn_stats.py, beside the completed turn's writer) sends the stats at once on the existing chat_message_update patch, keyed on the row's mid, which the client already merges into the row's meta.

Backend: the footer goes on before the shutdown save, and the write marks the slot dirty. While the gateway shuts down, the turn's teardown skips its save, so _persist_partial_reply's own shutdown save is the last write the reply gets, and on main the footer is attached after it, inside the usage write. The seam is split: _stamp_abnormal_turn_footer puts the footer on and takes the turn's single billing read, synchronously, before that save (which now also runs when the footer is the only new thing on the reply); _record_abnormal_turn_usage then writes the row from the same read. The order "text first, usage write last" is unchanged. The footer write is in place, so _attach_abnormal_turn_stats marks the slot dirty itself: the periodic flush writes only a dirty slot.

Backend: the footer and the usage row show one figure, and the footer is put on once. A recovery arm's completion that reported no billing writes no usage row; on main the seam then attached the completion's empty figures to the reply and wrote the row from the provider's live read, so the footer omitted the credits the row recorded. The stamp now attaches the completion's figures only when the completion wrote the row (_turn_usage_persisted), ttft_ms included, as main does; otherwise the footer and the row come from the seam's one read. _turn_footer_attached keeps the footer to one write per turn, so a late cancel after the end-of-turn attach, which on main re-stamped the same figures, neither stamps nor patches again.

Backend: a cancel on the seam's shutdown save does not cost the arm that called it. The save caught Exception, which a CancelledError is not, so a shutdown that cancelled the turn task on that await propagated out of _persist_partial_reply into the recovery arm, which then lost its card and its recovery. The cancel is swallowed as the usage write already swallows one: _persist_abnormal_turn_usage on main catches the CancelledError of its own write inside the same teardown, for the same reason (re-raised, it escapes the recovery handler and strands the completion the finally owes), so a shutdown that cancels the turn task during this save ends the arm the way it already ends one cancelled during the usage write. test_a_cancel_on_the_shutdown_save_still_leaves_the_arm_its_recovery injects that cancel into the save under the real _run_chat, as main's test_raw_complete_survives_cancellation_during_token_persistence injects the one the usage write swallows. The text save itself runs as it does on main, unguarded: the guard earlier revisions put around it answered no reported failure and is gone (see "Review dispositions"). The footer stamp, which this change runs ahead of that save, is guarded, because the billing read it makes came after the save on main, so a raise in it never cost the text its save at shutdown and must not start to.

Backend: one identity walk, scoped by the turn's start row. _last_reply_row (chat_turn/turn_stats.py) is the rule for the row an abnormal end stamps and the row the turn's file chips attach to: among the rows appended since the turn began, by _turn_rows with the boundary and the start identity _turn_start_mid the runner already hands the file-change flush, the newest reply the runner recorded. On main the stamp scanned slot.messages[turn_boundary:], which a window at its cap has shifted, so the cut reply got no footer there; the flush's on-loop attach half (_attach_file_changes, since #19781) had its own inline copy of the identity walk, and now calls the shared one; the one rule the shared walk adds to it is the notice skip, so a turn's file chips can no longer attach to a system notice row where the turn recorded no reply (its anchor tests TestFlushFileChanges::test_injected_assistant_row_is_never_the_anchor and test_own_reply_wins_over_a_later_injected_row go red when the shared walk's identity rule is removed). _completed_reply_row gives the completed turn's attach (_attach_turn_stats, which gains turn_start_mid) the same scoping: the recorded reply where the turn recorded one, else the position rule, the newest assistant row that is not a system notice, so a /compact-style turn whose confirmation is a plain assistant row does not put the footer on the notice appended after it. Both forms pass over a system notice; on a real slot the identity rule already excludes one, since a notice is never recorded as a reply, so this matters where the position rule applies.

Frontend: grouping finds the end of a cut-short synthesis answer. groupDisplayItems reads turn_stats as the end of a fan-out synthesis answer. A synthesis answer an error cut short carries stats on its first half, so answerEndIndex takes an error card or a system notice drawn after it, before any other reply, as part of the answer, with the rows between them, passing over another writer's envelope (a workflow result or a sub-agent completion, which the runner never records as its reply), and carries the boundary past a recovery inject to the resumed half. For a resumed answer that is where main draws it today; an answer cut short with no recovery now ends with the rows that report on its turn, as a completed answer ends at its reply, so the next wave folds instead of the whole region staying unfolded. The MCP App promotion pass (transcriptRows.ts) also ends a loose region at a stamped reply; any row after a cut-short reply makes an app-bearing batch a grouper turn, which that pass keeps whole, so it cannot split a resumed turn. A comment there, a grouping test and a test over the real useTranscriptRows record it.

Frontend: the cut half of a resumed reply is not a working step. TurnBlock's collapse-all split keeps a turn's last reply and folds the rest. A reply an error cut short carries the stamp, and the recovery inject resumes the same turn, so the recovered remainder is the block's conclusion and the stamped first half folded as a step with its footer. findResumedReplyRows pins that reply and the recovery row out of the fold, the way findAnsweredRefusalRows already pins an answer and the tool-refusal card that followed it; between the two only an error card, a system notice or another writer's envelope may sit (the grouper's isTurnStatusRow / isEnvelopeRow, now exported), stamped text a tool call followed is narration and still folds, and a cut reply with no stamp (a transcript older than the stamp) folds as before. Four TurnBlock tests pin it; the two pin cases fail on the previous split with the cut reply folded.

docs/system-specs/modules/turn-stats-footer.md and docs/system-specs/modules/crew-log-emitter.md describe the seam as it now runs; docs/feature-map/README.md gains a "Reply footer" row naming the new module.

Decision for the owner

Removing _attach_owned_turn_stats, which #19984 introduced. Its one production caller (_attach_turn_stats) passed reply_mids=None and the function then read the slot's own list, so the explicit-list form had no caller; its unit test (test_reply_mids_skips_a_row_another_writer_appended) is replaced by test_lands_on_the_recorded_reply_not_a_row_another_writer_appended, the same scenario through _attach_turn_stats with the reply recorded on the slot as the runner records it. If the owners want the name kept, it comes back as a one-line alias.

Review dispositions

Each CONCERNS item from the fork review lanes (heads ff448c59, 50ea7d7d, 25225baf, d5c712a0, 430a776f and 60d35f73) and what this PR does with it:

  • Design, First Principles: replyShowsActions took Copy / Fork / More off the cut half, against the Goal. Removed. The four symbols (replyShowsActions, recoveryResumes, showActions, actionsShown) and their tests are gone and showFooter alone decides the footer, which is the subtraction First Principles named. The cut half keeps its actions, as the Goal and Reply loses its footer (model, credits, Copy/Fork) when its turn ends early or an auto-nudge follows #19855 say and as main's backend already stamps it.
  • UX (ff448c59): a Copy under the cut half copies a fragment, and nothing links the halves. Declined, per the Goal; the halves sit adjacent with the connection card and the recovery row between them, which is the cue the default view has. A "continued below" marker is not part of this change (Not a goal).
  • UX (50ea7d7d): the cut half's stats line reads as the whole answer's cost, and the action row moved between halves during the live window. The second is gone with the split. The first is accepted: the two halves are two usage rows and each footer names its own turn's cost; a combined cost is not part of this change (Not a goal).
  • Design: "cut and resumed" is inferred in three places. Two now (TurnBlock.findResumedReplyRows and the grouper's answer end), both on the grouper's row predicates. An explicit marker the backend stamps on the cut row (it knows, in _persist_partial_reply) would replace both reads; it is a persisted protocol field with an old-transcript fallback, so it is not part of this change (Not a goal).
  • UX (25225baf): the first wave's "Sub-agents finished" card folded behind a second "Worked through 1 step" toggle in frame (c). Fixed. The collapse-all pin wraps the synthesis row, the cut half, the connection card, the recovery row and the resumed half into the answer's one turn, and with the halves pinned the synthesis row was the one step left to fold, where main shows it (its two-row batch is too short to wrap). findResumedReplyRows now pins the synthesis row directly above the cut reply too, so that turn has no toggle; a synthesis row a tool call separates from the reply folds with that step, as on main. Frame (c) recaptured on this build.
  • UX (25225baf): the cut half's footer looks like a finished reply's, so half an answer reads as complete; smallest fix a muted "Continued below" in its stats line. Declined for this change, as the same item was on ff448c59: the Goal keeps the actions on the cut half, the connection card and the recovery row sit between the halves in every view (the collapse-all pin keeps them there), and the cue is a small change of its own (Not a goal). The owners decide at merge whether to take it.
  • UX (d5c712a0): the same item, reworded: the cut half's full footer and own price read as a finished answer, and "nobody has done a blind read"; smallest fix an "interrupted · 0.12 credits" marker on the cut row's stats line. Same disposition: declined for this change per the Goal, the cue is a small change of its own (Not a goal), and whether to take it is the owners' call at merge. Design and First Principles passed this head with the full footer on the cut half.
  • Design (25225baf, re-raised): turn_stats means both "footer figures" and "turn ended", so the frontend walks infer "cut and resumed" from row shape; clears with an explicit marker on the cut row or a maintainer recording the heuristic as the contract. Same point as the Design item above, dispositioned the same way: the two walks share the grouper's predicates, the status rows they pass over are the ones answerEndIndex already named before this PR, and the backend marker is a persisted protocol field with an old-transcript fallback (Not a goal). Recording the contract is the maintainers' call.
  • First Principles: the file-chip notice skip, the _reply_flushed rename, the shutdown-save cancel swallow. Declared in "What changed", reverted, and matched to _persist_abnormal_turn_usage's own swallow with the test named, respectively (previous revisions).
  • First Principles (430a776f): the seam's text-save try/except and the swallowed CancelledError on its shutdown save rest on an asserted failure, not a reported one; subtraction offered for both. Taken for the text save: the guard is gone, with test_a_failing_reply_save_still_queues_the_recovery, which injected the failure it asserted, and the save runs as on main. Kept for the cancel, on the precedent the lane named: _persist_abnormal_turn_usage on main swallows the same cancel in the same teardown, under a test that injects it too (test_raw_complete_survives_cancellation_during_token_persistence), and the shutdown save already caught Exception on main; this widens that to the cancel a shutdown delivers ("What changed" has the mechanism).
  • First Principles (60d35f73): isTurnStatusRow's notice arm restates CompactionCard.isSystemNoticeRow. Taken: the grouper's predicate now reads msg.role === 'error' || isSystemNoticeRow(msg), the one notice test the footer walk and TurnBlock already import; nothing behavioural changes (the two reads were the same expression), and CompactionCard's import graph does not reach the grouper, so no cycle.
  • Design (hold at 430a776f): a cut reply that was streamed has no mid on the client until a refresh, so does it get the live footer? It does, and no refresh is needed: slot.append in _persist_partial_reply broadcasts the cut reply's own chat_message frame, which carries its mid, before _broadcast_turn_stats sends the mid-keyed patch; the client merges the frame's meta onto the streaming row (Frontend renders duplicate assistant messages after gateway restart during active turn #1704's chatSlice cases) and the patch then matches by mid (chatSlice.messages.test.ts). The stall test in test_chat_runner_abnormal_turn_usage.py now pins that frame order.
  • GPT 6.1 (e7b74caa, LOW on adjudication): a reply steered mid-turn and then cut with no further text never receives the mid-keyed footer patch. A known limit of this change, left as is. That reply was saved by the steer cut, quietly on purpose (_steer_segment_cut calls _flush_segment(quiet_persist=True): the clients already hold its text in their frozen row, so the chat_message frame that would carry its mid is not sent), so at the stall _persist_partial_reply appends nothing, _last_reply_row stamps the saved row, and _broadcast_turn_stats names a mid no client row carries (sseChatMessagePatchByTs matches mid exactly, and the frozen row has no server ts either). The footer is on the saved row and reaches the page with the next refresh, as _broadcast_turn_stats's docstring says and as the file-change chips attached to that same row by the same walk already do. Giving the frozen client row the saved row's identity is a change to the steer path, not to this one.
  • Design (9e639d7e, PASS note): the stamp also marks where a turn ends for the page (isTurnEnd, answerEndIndex, findResumedReplyRows), so a writer stamping a row that is not the turn's last reply would move the fold. Taken: the spec (turn-stats-footer.md) now states that contract in the paragraph on the frontend readers.
  • Design (0a7cd15e, PASS note, r125 item 2): point to a backend test that only _last_reply_row / _completed_reply_row receive turn_stats. Taken: test_turn_stats_lands_only_on_the_row_the_two_selectors_chose (test/test_turn_stats.py) scans src/kiro_crew for every X["turn_stats"] = ... and requires X to be bound from one of the two selectors, through an alias if there is one; the two other places the key is built are listed in the test with the reason each is not such a write (the live patch's frame in _broadcast_turn_stats is a payload, not a row; inject_cron_result_to_dashboard appends the cron result row with its own run's figures, so the stamp sits on the row that ends that run), and a new one fails the test by name until it is traced. Red on main: _attach_owned_turn_stats writes the key inside its own walk of the window, which is the drift the note describes. A self-test on synthetic source pins the shapes the scan reads, and three mutants (each stamp bypassing its selector for slot.messages[-1]; a {"turn_stats": ...} literal added to another module) fail it with the offending function named. The spec's contract sentence and its Tests list point at the test.
  • Opus (0a7cd15e, note, r125 item 2): the feature-map row said chat_runner.py stamps through _persist_partial_reply. Fixed: the row's handler cell now names chat_turn/turn_reply_seams.py (_persist_partial_reply stamps that end's footer) and its callers, chat_turn/acp_recovery.py, stop_recovery.py and turn_failures.py, and says _attach_turn_stats is called from stop_recovery.py; chat_runner.py never references the helper, as the lane said.

Tests

Proof: PROVEN test/test_chat_runner_abnormal_turn_usage.py::TestErrorEndTurnFooter::test_a_cut_reply_gets_its_footer_in_a_window_at_its_cap, test/test_chat_runner_abnormal_turn_usage.py::TestErrorEndTurnFooter::test_a_shutdown_saves_the_partial_reply_with_its_footer, test/test_chat_runner_abnormal_turn_usage.py::TestErrorEndTurnFooter::test_a_shutdown_saves_a_footer_put_on_a_flushed_segment, test/test_chat_runner_abnormal_turn_usage.py::TestErrorEndTurnFooter::test_a_stall_sends_the_cut_reply_its_footer_before_the_recovery_runs, test/test_chat_runner_base_surface.py::test_a_moved_name_keeps_its_base_shape_and_owner[turn_stats:_attach_turn_stats] (head c7cd586)

  • test/test_chat_runner_abnormal_turn_usage.py — TestStoppedTurnFooter and TestAbnormalEndFooter (fix(dashboard): keep the reply and its footer when a turn ends abnormally #19984's, kept unchanged) pin the stamp on each end. TestErrorEndTurnFooter, driving the real _run_chat with the real provider_last_turn_usage, pins the seam around it: the turn ceiling through the real bounded_chat_turn with the native stop acknowledged and not (the deadline timer held and fired once the reply streamed; the acknowledged stop resolving on the completion's usage-write signal under a hang-only bound; which path billed the turn pinned apart from how the stop was answered; the acknowledged footer keeping the completion's ttft_ms, from a fixed 250 ms first-output clock, and the unanswered one recording none, as a Stop does); a periodic flush between the reply's save and its footer still leaving the slot dirty; a cut reply in a window at its cap getting its footer, found from the row the turn started after; the reply's last save at shutdown carrying the footer, also when the text was already a row and the footer is all the cut adds; an error or a cancel after the end-of-turn flush, after a billed or an unbilled completion, leaving exactly one reply row and neither stamping nor patching the footer again; a recovery arm whose completion reported no billing billing the turn once under its own stop_reason, with a footer that matches that row; a cancel landing on the helper's shutdown save still leaving a stall arm its card, its recovery and its row; a stall sending the cut reply its footer on a chat_message_update keyed on the row's mid before its queued recovery runs, and after the reply's own chat_message frame carrying that mid, so a client that streamed the reply holds the key the patch is matched by; and a failed compaction after a tool call putting the footer on the reply, not its notice. A module-level test pins that _last_reply_row passes over a notice.
  • test/test_turn_stats.py — _attach_turn_stats lands on the recorded reply, not an envelope another writer appended after it; a turn that recorded no reply keeps the position rule; a system notice after the reply is passed over; test_turn_stats_lands_only_on_the_row_the_two_selectors_chose scans the backend for every write of meta["turn_stats"] and requires its row to come from _completed_reply_row or _last_reply_row, with the two other builders of the key listed by name and reason (see "Review dispositions"), and test_the_turn_stats_write_scan_reads_each_shape_it_claims is its self-test on synthetic source. fix(dashboard): keep the reply and its footer when a turn ends abnormally #19984's test_reply_mids_skips_a_row_another_writer_appended goes with the function it called (see "Decision for the owner"); the first case above is its scenario through _attach_turn_stats. test/test_chat_runner_base_surface.py (the moved-name surface table refactor(dashboard): move the runner's turn helpers into chat_turn #21086 split out of the composition contract) pins the new signature, with fix(chat): re-send a throttled turn with one copy of the prompt in history #21907's retries keyword after turn_start_mid. test/test_chat_runner_turn_plumbing.py lists _stamp_abnormal_turn_footer with the seam's other functions refactor(dashboard): hoist the chat turn's closures into chat_turn #22057 hoisted into chat_turn/turn_reply_seams.py, so the turn-first and async-guard rules read it too.
  • website/src/test/replyFooter.test.ts — the shared rule: stamped replies keep the footer under a nudge cycle, an error card plus recovery, and a later run; nudge / sub-agent / cron rows end the turn above them; a recovery inject and a same-turn reply do not; notice and say-nothing rows are passed over; streaming rows never draw it; the drawn row's own role and stats decide, even where the live list holds another row at its index.
  • website/src/test/AppSdkMessageRenderersCov80.test.tsx — the same two cases through the SDK renderer.
  • website/src/test/groupDisplayItems.test.ts — a synthesis answer cut short and resumed stays out of the next wave's fold, and so does the error card under an answer cut short with no recovery; the tool row, notice and error card after an answer cut short stay with it, with a workflow envelope among them; a reply cut short and the rows after it form one turn.
  • website/src/test/TurnBlock.test.tsx — a reply cut short and resumed: the cut reply and the recovery row stay visible above the resumed half, with the tool row folded and the toggle counting one step; a system notice and a sub-agent envelope between the two are passed over; stamped text a tool call followed still folds; a cut reply with no stamp folds as before; the synthesis row that led the cut reply stays with it and the turn has no toggle; a synthesis row a tool call separates from the reply folds with that step.
  • website/src/test/transcriptRows.cutReply.test.tsx — through the real useTranscriptRows, the MCP App row and the cut reply stay in one turn at every point of a turn an error cut short and a recovery resumed, running or idle.
  • website/src/test/ChatPage.footerNotRetracted.test.ts, website/src/test/ChatPage.systemNoticeScans.test.ts, website/src/test/invisibleText.test.ts — the source-scan pins on the removed inline walks now pin that both surfaces call replyShowsFooter, reading the page and its owners under pages/chat/page/, and exercise it directly.
  • website/src/test/chatSlice.messages.test.ts — the live footer's chat_message_update, keyed on the reply's mid with turn_stats alone in its meta, adds the footer and keeps the rest of the row's meta (its mid first of all); the sibling row sharing its ts gets nothing. Red when the reducer replaces the meta instead of merging it.

Red on base. This branch's backend tests run against main's chat_turn/turn_reply_seams.py, chat_turn/turn_entry.py, chat_turn/turn_locals.py, chat_turn/turn_stats.py, chat_turn/file_changes.py and chat_turn/stop_recovery.py: 10 of TestErrorEndTurnFooter's 17 cases and three of the four new test_turn_stats.py cases fail with the reported symptom: the two shutdown tests ("the reply was saved at shutdown without its footer", "the footer put on at shutdown was never saved"), the capped window ("the reply the turn's end cut short carries no footer"), the stall patch ("the cut reply's footer was never sent to open clients"), the four unbilled-arm cases and the shutdown-cancel case (KeyError: 'credits': the footer lacks the credits the row records), and the dirty-mark test, and in test_turn_stats.py the recorded-reply case (no turn_start_mid), the notice case (the notice took the stats) and the selector scan ("turn_stats written onto a row no selector chose": main's _attach_owned_turn_stats, line 183). Green on main and kept as guards: the ceiling test (its ttft_ms assertion was red on this PR's previous revision, which dropped the completion's ttft_ms on the cut-after-completion path), the four late-end cases (the second stamp they forbid writes the same figures on main, which has no patch to send; they go red here when either half of the once-guard or the completed path's own flag is dropped), the compaction-notice case (the identity rule alone places that footer; it goes red when the notice skip is removed from the position rule's branch), and test_turn_stats.py's position-rule case (a turn that recorded no reply lands on its newest assistant row on main too). Earlier mutation runs on this tree, all still in force: catching only Exception around the shutdown save fails the shutdown-cancel test ("the cancelled save cost the stall arm its card"); withholding the reply's own chat_message frame (a reader attached to the slot) fails the stall test at its frame-order assertion, the row frame missing from the wire; removing _stamped from the shutdown-save condition fails the flushed-segment shutdown test; dropping the dirty mark fails the flush test; passing no start identity fails the capped-window test; dropping the identity rule from the shared walk fails TestFlushFileChanges' anchor tests. Frontend: seven footer cases fail with the old walk restored, the two drawn-row cases with the rule reading messages[index], the resumed-answer grouping case with the old first-stamp boundary, the error-card grouping case with the card not taken into the answer, the resumed half folds without the envelope pass-over, and the synthesis row folds behind a one-step toggle without the lead-row pin; raising the grouper's wrap threshold by one fails the useTranscriptRows test at the prefix that ends on the error card.

Run locally, on the change rebased onto main 13e3ff298b (past #20526's per-turn state object, #20388's ChatPage split, #20453's single fold state in TurnBlock, #20755's and #21086's moves of the runner helpers into their chat_turn owners, after which the _flush_file_changes edit lives in chat_turn/file_changes.py and the signature pin in test/test_chat_runner_base_surface.py, #20805, which moved the glued-marker repair inside _redact_segment, so the partial-reply save now hands it the accumulated text the way the end-of-turn flush does, #21907, whose retries count the completed turn's attach now carries, and #22057, which hoisted _run_chat's closures into their owners, after which the seam (_persist_partial_reply, _stamp_abnormal_turn_footer, _record_abnormal_turn_usage, _attach_abnormal_turn_stats) lives in chat_turn/turn_reply_seams.py as functions that take the turn first, and #22150, which moved the turn's prologue into phases, after which the _turn_footer_attached flag is initialised in chat_turn/turn_entry.py beside _turn_usage_persisted, and the start identity turn_start_mid is main's own turn attribute, and #21266, whose post_turn_reply reads the runner's _reply_mids local after the attach, so the line that defines it stays where main has it, and #22914, which settles the run the live stream held at a tool call or approval prompt before the partial-reply save and reports whether a row changed, so the shutdown save's condition is now main's own rows_changed flag or the footer stamp, and the seam's own text-appended flag is gone, and #22682, which moved the stream's end and the turn's tail into phases, after which the completed turn's attach, with its turn_start_mid and the _turn_footer_attached mark, lives in _turn_persist_and_settle (chat_turn/stop_recovery.py) and the completion arm in _on_complete (chat_turn/turn_stats.py), and #23528, which trimmed the runner's imports to what reads them and has each owner import the other names it reads at run time, after which this change adds no line to chat_runner.py: turn_stats.py imports is_system_notice itself, and the sibling names it and file_changes.py read (_turn_rows, _last_reply_row) are typed from their owner files, and #23656, which moved _persist_abnormal_turn_usage from the runner into chat_turn/turn_stats.py, so the seam's type-checking import takes it from there beside the footer helpers it already names, and #21222, which added the transcript's copyOnSelect prop to the same <AssistantMessage> element whose inline footer walk this change replaces with replyShowsFooter, so the element carries both, and #23977, which moved the ticket-named test files to their module homes, so the seam's tests live in test/test_chat_runner_abnormal_turn_usage.py, and #23275, which keeps the transcript's row handlers stable while a reply streams, so the onTogglePin, onQuoteMessage and onRegenerate props on that element are now main's stable forwarders on either side of the showFooter this change replaces, and #19781, which moved the turn-end file-change snapshot off the event loop, after which the row walk this change replaces with _last_reply_row lives in _attach_file_changes, the on-loop attach half that _flush_file_changes and _flush_file_changes_off_loop share, and #24774, which dropped the strict xfail that #24276 had left stale in test/test_crew_log_fullscan_guard.py, a file this change does not touch, so backend shard 2 passes again on every head built on this base, and #23838, which added the message-reaction props (activeReactions, onToggleReaction, reactionError, onClearReactionError) to the same <AssistantMessage> element, and #26157, which reverted them, so that element is main's own again apart from the showFooter this change replaces, and #23769, which keeps the previous reply on screen while a Regenerate runs: its beingReplaced and startsNewReply labels wrap that same element, its firstNewReplyIdx reads isSystemNoticeRow, so the transcript keeps that import beside replyShowsFooter, and chat_turn/file_changes.py's type-checking imports name its note_regenerate_reply beside _last_reply_row, and #25944, which brought test/kiroUsageRefetchInterval.test.ts in line with #25434's parser (an unavailable reading under API-key auth is none, not a terminal api-key), a file this change does not touch, so frontend shard 1 passes again on every head built on this base): pytest over the 463 backend files that reference _run_chat, the seam, the stats footer, the file-change flush, the chat_turn owners or the runner module (20134 passed, 4 skipped, 3 failed: the two TestRealHookProcess tests that spawn a real hook process and test_app_agent_launch_copy.py's opted-out steering case, which fail on this host the same way on an untouched main checkout and touch nothing this change does), and the seam, stats, base-surface, composition, compose-binding, turn-plumbing, shared-state, turn-cancel, ordinal and timeout-consistency files again, 952 passed across 13 files, with #21907's throttle and rewind files and #22150's and #22682's plumbing and composition tests among them; main's own TestStoppedTurnFooter and TestAbnormalEndFooter pass on this branch unchanged; vitest over the whole frontend suite, 3545 files (57899 passed, 1 expected fail that is upstream's own); tsc, eslint, mypy, black (the ratchet gate), flake8, isort, jscpd, the i18n check, docs-lint.sh, the new-test stability repeat (three passes over the three leaf test files this change adds or modifies, with the job's own flags), and the comment-history, brand (on the added lines), focus-cue, file-line-cap and feature-map gates all clean.

Manual verification

The built SPA (npm run build of main and of this branch), served by the repo's own transcript harness (website/scripts/lib/transcript-harness.mjs) over fixture API responses, with three seeded transcripts: (a) a completed reply followed by an auto-nudge cycle and its reply, (b) a reply the model cut short mid-stream, the "Connection unstable — resuming…" card, the runner's recovery inject and the recovered answer, where the cut reply carries the stats the backend half now stamps, and (c) a two-agent fan-out whose synthesis answer is cut short the same way and resumed, followed by a second wave and its synthesis; in (c) the cut half carries stats in both builds, as main's backend stamps them since #19984. On main (built before #19984 merged; its frontend walk, which #19984 did not change, hides the footer the same way on today's main) the earlier reply in (a) and (b) has no stats line and no Copy / Fork / More row (0 buttons); on this branch it has both. In (b) main folds the cut reply behind the turn's "Worked through" toggle; this branch shows both halves with the recovery row between them and has nothing left to fold, each half with its own footer. In (c) main folds the resumed half of the answer behind the next wave's toggle; this branch keeps both halves in the open. The frames below are those runs, cropped to the transcript rows. The backend half is exercised through the real _run_chat in the tests above; no live gateway was driven.

Screenshots / video

Synthetic transcripts, transcript rows only.

(a) A completed reply, then an auto-nudge cycle. Before: the first reply has lost its footer. After: it keeps the stats line and its actions; the cycle's reply has its own.

Before After
auto-nudge-before auto-nudge-after

(b) A reply cut short by the model at capacity, then recovered. Before: the cut reply has no footer; only the recovered answer does (the before frame has the turn's fold expanded so the cut reply shows at all). After: in the default setting with no fold, the cut reply shows its own footer (its turn's cost, Quote / Copy / More), then the connection card, the recovery row and the recovered answer with its own.

Before After
capacity-retry-before capacity-retry-after

(c) A sub-agent synthesis answer cut short and resumed, then a second wave. Both frames are the default collapse-all-steps setting. Before: the resumed half, which carries the recommendation, is folded behind the second wave's "Worked through 3 steps" toggle, a toggle that promises a restatement below that never comes; only the cut half is in the open. After: both halves of the answer are in the open, the cut half with its footer, then the connection card and the recovery row, then the resumed half with the recommendation and its own; the second wave's "Worked through 1 step" toggle sits below it where the wave starts, and the first wave's "Sub-agents finished" card stays in the open above the answer, as it does on main; the answer's turn has nothing left to fold.

Before After
synthesis-fold-before synthesis-fold-after

Related Issues

Closes #19855

Refs #15013, #17669, #11523, #12934, #18947

Relation to #19984

#19984 (opened for the same issue while this change was in review) merged while this PR was open, and this PR is rebased on it: the abnormal-end stamp, the recovery arms and the generic arm through the seam, the once-per-turn save and the identity rule on the completed turn's attach are its, and this PR keeps TestAbnormalEndFooter and test_an_involuntary_cancel_gets_the_footer_too unchanged (its pre-dispatch test is this PR's under the parametrised name). On top of it this adds: the frontend half it deferred, without which the auto-nudge case in #19855 stays broken and a stamped reply still loses its footer under the recovered answer; the footer before the shutdown save, so a gateway restart mid-turn keeps it; the live chat_message_update patch, so the footer reaches the open page before a queued recovery runs rather than after it; the capped-window case (_turn_rows by start identity, where a scan from the boundary index finds nothing); one billing read shared by the footer and the usage row where the completion wrote no row, so the two cannot disagree; the once-guard on the footer; a cancel-tolerant shutdown save in the seam, so a shutdown that cancels the turn task during it cannot cost a stall arm its card or its recovery; one spelling of the identity walk (_attach_file_changes calls it too); and the grouping and promotion-pass changes a stamped cut-short reply needs so a resumed synthesis answer does not fold behind the next wave. It removes _attach_owned_turn_stats (see "Decision for the owner").

Pattern harvest

Rule candidate: review-prompt
Pattern: an end-of-turn duty (save the reply, attach its stats) done once after the stream loop, with early returns and exception arms in between that skip it; and an inline "has this turn ended" walk that hard-codes role === 'user' as the only boundary instead of calling the shared opensTurn predicate, duplicated per surface.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@hickoxd
hickoxd requested review from a team and KiroCrewCaptain as code owners October 14, 2026 04:57
@hickoxd
hickoxd requested a review from mbriones98 October 14, 2026 04:57
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of c7cd586f42c3ddc95ea88a37b81e0cdbb2e269c3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The six before/after stills show every state the diff changes: the footer after an auto-nudge reply, the cut-and-resumed reply, and the resumed synthesis answer kept out of the fold. This lane has no blind reader, so nobody new to the product has read them.

Notes

  • In attachment-04 and attachment-06, the two halves of one resumed answer each get a full footer ("0.12 credits" above "Turn interrupted", "0.15 credits" below), so a reader may take the first figure as the whole cost. The PR scopes out a "continued below" marker; it is still the cheapest follow-up if the owners want one.

[UX-REVIEWED] c7cd586

Description read

[DESCRIPTION-READ] 893f38678c06f9addf476dc034c96115bf962f20913a3811f483466bb2ed62f5

That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of c7cd586f42c3ddc95ea88a37b81e0cdbb2e269c3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level blockers: the shared rule fixes the walk at its root, and the backend stamps each abnormal end once, ahead of the shutdown save.

Notes

  • The frontend now reads turn_stats to decide where a turn ends, not just as figures to show (isTurnEnd, answerEndIndex, findResumedReplyRows). That makes the stamp's placement a wire contract. The AST scan in test_turn_stats_lands_only_on_the_row_the_two_selectors_chose guards it. Keep that scan's allow-list strict rather than widening it the first time it goes red.
  • Case 6 (the collapse-all pin and the synthesis grouper's answer end) changes fold behaviour, which is more than footer rendering. It is in the stated Goal, but it is the change most likely to need walking back alone. Splitting it into its own commit would make that revert clean.

[DESIGN-REVIEWED] c7cd586

Description read

[DESCRIPTION-READ] ffd9862c4a35429a202ff4cda4ab68aa84c3601b00b4c5b1f9002322f56bee8d

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of c7cd586f42c3ddc95ea88a37b81e0cdbb2e269c3 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Every item answers a case in #19855 with a test, and the two footer walks become one shared function, replyShowsFooter. The new live patch, _broadcast_turn_stats, writes inline like every other chat_message_update site. No shared helper exists for it to duplicate.

What this change ships

Inventory (10 items) — 10 justified

Intent: a reply keeps its model/credits line and its Copy/Fork/More actions however its turn ended and whatever is drawn below it. FIX.

  1. An earlier reply keeps its footer when an auto-nudge, sub-agent or cron turn replies below it — justified
  2. A cut-short reply keeps its footer once a recovery's resumed answer is drawn below it — justified
  3. An abnormal end's footer reaches the open page at once, before a queued recovery finishes — justified
  4. A reply cut by a gateway restart mid-turn keeps its footer after the restart — justified
  5. A reply in a window at its row cap gets its footer — justified
  6. When a recovery arm's completion reported no billing, the footer shows the same credits as the usage row — justified
  7. With collapse-all on, the cut half of a resumed reply, its recovery row and the synthesis row leading it stay unfolded — justified
  8. A sub-agent synthesis answer that was cut and resumed is no longer split at the cut — justified
  9. A cancel landing on the shutdown save no longer costs the recovery arm its card and its recovery — rides along
  10. File chips skip a system notice; the SDK and side chats keep a stamped footer while a later run is going — justified

[FIRST-PRINCIPLES-REVIEWED] c7cd586

Description read

[DESCRIPTION-READ] f4697ecfae1b4e108213c22c9fbd0265f5613fb74be371d64f070d1167d7339b

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed c7cd586f42c3ddc95ea88a37b81e0cdbb2e269c3 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c7cd586

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed c7cd586f42c3ddc95ea88a37b81e0cdbb2e269c3 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c7cd586

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026
@hickoxd
hickoxd force-pushed the fix/turn-footer-after-error branch from 209d251 to bc07f4b Compare October 14, 2026 06:29
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 14, 2026
@hickoxd
hickoxd force-pushed the fix/turn-footer-after-error branch from bc07f4b to d8de271 Compare October 14, 2026 07:17
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 14, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 15, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 04a922d.

This PR makes a reply keep its stats footer however its turn ended: one shared replyShowsFooter rule for the chat page and the SDK, a chat_message_update patch that delivers the stamp before a queued recovery runs, and the footer written before the shutdown save.

What blocks approval:

  1. CI on this head is not settled. Eight backend shards are still running, E2E (stub ACP backend, offline) failed, and the fork GPT 6.1 and Opus 5.5 lanes and Internal Content Scan 'could not run'. Sensitive Change Review failed reading the PR from the API and needs a re-run. A maintainer has to re-run the fork lanes.
  2. No AI lane has reviewed this head; the Design, First Principles and UX verdicts are for 50ea7d7. All three raise CONCERNS, and none has a disposition. The main one: replyShowsActions takes Copy, Fork and More off the cut half of a resumed reply, but the Goal says a reply keeps them 'however its turn ended'. Either keep the actions on the cut half, or have a maintainer accept the move and amend the Goal. Design also notes that three separate walks infer 'cut and resumed'. UX notes that the cut half's stats line can read as the whole answer's cost.
  3. Not a goal defers a 'continued below' cue and a combined cost as 'separate changes'. If that is a real follow-up, link an issue for it.

This clears when CI is green on the head, the AI lanes have run on it, each CONCERNS item has its own disposition, and the action-row decision is settled. I read the description and the main production diffs. I did not run anything.

— crew-pr-reviewer (r103)

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 15, 2026
@hickoxd
hickoxd force-pushed the fix/turn-footer-after-error branch from 04a922d to 3933034 Compare October 15, 2026 17:35
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 15, 2026
@hickoxd
hickoxd force-pushed the fix/turn-footer-after-error branch from 3933034 to 25225ba Compare October 17, 2026 18:33
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 17, 2026
mbriones98
mbriones98 previously approved these changes Oct 18, 2026

@mbriones98 mbriones98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checks green and PR Readiness passed at 430a776; non-feature change.

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at 430a776.

The r103 blockers are cleared. CI is green on this head, the lanes have run on it, and the cut half of a resumed reply keeps Copy / Fork / More, as the Goal says.

What still needs an answer on this head:

  1. First Principles item 9: the shutdown save now swallows CancelledError as well as Exception (chat_runner.py#L4856-L4876), and the text save is wrapped best-effort. The only evidence is a test that injects the failure. Post a target=first-principles disposition for this head that links a real failure, or argue why matching _persist_abnormal_turn_usage is enough, or drop the wrapping.
  2. Design punchline: _broadcast_turn_stats keys the patch on mid when there is one. Show that a cut reply drawn from streamed chunks, before any refresh gave it a mid, still gets the footer, or point to the test that covers it.
  3. Owner decisions: the UX lane asks a human to accept that a cut half reads as a finished reply with its own cost, and the description asks the owners to accept removing _attach_owned_turn_stats. A maintainer comment on each clears them.

Reviewed head: 430a776

— crew-pr-reviewer (r111)

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at fc154b5. Nothing has been posted since our r111 hold, and this head is a rebase with wording changes.

Still unanswered:

  • First Principles item 9: the shutdown save swallows CancelledError (turn_reply_seams.py#L153-L157). The only support is symmetry with the usage write. Post a target=first-principles disposition for this head that links a real failure or argues the symmetry, or narrow it back to except Exception:.
  • UX: a cut half draws a full footer, so it reads as the end of the answer and shows its own cost. A maintainer needs to accept that, since Not a goal declines the "continued below" cue.
  • Design punchline, plus our r111 item: show that a cut reply drawn from streamed chunks, before it has a mid, still gets the _broadcast_turn_stats patch, and that collapse-all keeps both halves visible. Point at the test that covers each.
  • Owner sign-off on removing _attach_owned_turn_stats.

CI is green and the GPT and Opus lanes have no findings on this head.

— crew-pr-reviewer (r114)

@hickoxd

hickoxd commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Item 9 — the shutdown save in _persist_partial_reply swallows CancelledError (span=97a6bf62bcf6)

rebutted, kept: except (Exception, asyncio.CancelledError) at chat_turn/turn_reply_seams.py L153 stays. main already catches Exception on this save; the change adds the cancel.
The save runs only when _gateway_shutdown_requested(state) (L137): the process is going away, which is what cancels the turn task and puts this arm inside the turn's CancelledError teardown. It is the last await before _record_abnormal_turn_usage -> _persist_abnormal_turn_usage (chat_runner.py L1405), which swallows the same cancel on its own I/O: "re-raising here would escape _run_chat's recovery handler and strand the durable completion the finally block still owes".
Narrowed back to except Exception, a cancel that lands one await earlier re-raises past that usage write, the arm's card and its recovery, and escapes the same handler; the precedent would then protect the teardown only when the cancel happens to land on its second await rather than its first. One teardown, one answer to a cancel.
No linked production failure, same as the precedent: its evidence is test_raw_complete_survives_cancellation_during_token_persistence injecting the cancel into the persist.
Test: TestErrorEndTurnFooter::test_a_cancel_on_the_shutdown_save_still_leaves_the_arm_its_recovery (test/test_abnormal_turn_usage_row_15013.py) injects a cancel into save_slot_off_loop with the drain flag set, inside a real _run_chat turn. On main's seam it fails (KeyError: 'credits': main stamps no footer on the cut reply), the stated clearing condition. The swallow itself is isolated by mutation: with only this except narrowed to except Exception on this head, it fails at "the cancelled save cost the stall arm its card".
If the owners prefer the narrow except regardless, it is a one-line change plus deleting that test; say so and it goes into the next revision.

@hickoxd

hickoxd commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

punchline and the r111 item, evidenced: a reply drawn from streamed chunks has no mid on the client until its own chat_message frame arrives, and it does not wait for a refresh. _persist_partial_reply saves the cut reply with slot.append (chat_turn/turn_reply_seams.py L109), which mints the mid and broadcasts the row frame with meta.mid; the footer stamp then calls _broadcast_turn_stats (chat_turn/turn_stats.py L72), the chat_message_update keyed on that mid, from the same call chain on the same connection, so the row frame is the one before the patch.
Server test: TestErrorEndTurnFooter::test_a_stall_sends_the_cut_reply_its_footer_before_the_recovery_runs (test/test_abnormal_turn_usage_row_15013.py): the patch is keyed on the cut row's mid, goes out before the recovery starts, and the row frame carrying that mid precedes it (frames.index(("row", mid)) < frames.index(("patch", mid))). Negative run: with the row frame withheld, exactly that assertion fails.
Client, frame -> streaming row: sseChatMessage's assistant branch (website/src/store/chatSlice.ts L320-328, non-active pane L537-545) finalizes the trailing streaming row and merges the frame's meta onto it ("crucially mid"). Tests: website/src/store/chatSlice.test.ts "a first-delivery assistant frame still finalizes the live stream" and "a late redelivered assistant frame does not clobber a newer live stream" (#1704; the second passes only if the first delivery put the mid on the finalized row).
Client, patch by mid: sseChatMessagePatchByTs (website/src/store/chat/messages.ts L455) finds the row by mid and merges turn_stats into its existing meta. Tests: website/src/test/chatSlice.messages.test.ts "patches the row named by mid, not the first row sharing its ts" and "a turn_stats patch by mid adds the footer and keeps the rest of the row's meta" (with the reducer mutated to replace instead of merge, the latter fails: mid missing).
Collapse-all keeps both halves visible: website/src/test/TurnBlock.test.tsx "keeps the cut reply and the recovery row visible above the resumed half" (collapseAll={true}: the stamped cut reply, the error row, the recovery inject and the resumed half are not folded; the tool row before them is) and "keeps the synthesis row that led the cut reply with it, leaving nothing to fold"; website/src/test/groupDisplayItems.test.ts "keeps a synthesis answer an error cut short and a recovery resumed out of the next fold".
Each half draws its own footer: website/src/test/replyFooter.test.ts "keeps its footer when an error card and the recovery reply follow" (the cut half) and "withholds it past a recovery inject, which continues the same turn" (the resumed half gets its footer when the turn ends, by the shared rule ChatPage.footerNotRetracted.test.ts "ChatPage draws its reply footer from the shared rule"). The description's collapse-all screenshot shows both halves with their footers above the resumed half.

@hickoxd

hickoxd commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Status at fc154b5 against r114:

  1. First Principles item 9 (span 97a6bf62bcf6): disposition posted (target=first-principles), rebutted, kept. main already catches Exception on that save; the change adds the cancel. The save runs only while the gateway is shutting down, the event that cancels the turn task, and it is the last await before _persist_abnormal_turn_usage, which swallows the same cancel on its own I/O so it does not escape _run_chat's recovery handler. Narrowed back, a cancel one await earlier skips that usage write, the arm's card and its recovery, and escapes the same handler. No linked production failure, same as the precedent (its test injects the cancel too). On this head, narrowing the except to except Exception fails test_a_cancel_on_the_shutdown_save_still_leaves_the_arm_its_recovery at "the cancelled save cost the stall arm its card". If the owners prefer the narrow except anyway, it is a one-line revision; say so and I will push it.
  2. Design punchline and the r111 item: disposition posted (target=design), one test per link. Server: the cut reply's own chat_message frame carries its mid and precedes the mid-keyed chat_message_update (test_a_stall_sends_the_cut_reply_its_footer_before_the_recovery_runs). Client: the assistant frame finalizes the streaming row and merges the mid onto it (website/src/store/chatSlice.test.ts, the Frontend renders duplicate assistant messages after gateway restart during active turn #1704 cases); the patch finds the row by mid and keeps its meta (chatSlice.messages.test.ts). Collapse-all: TurnBlock.test.tsx "keeps the cut reply and the recovery row visible above the resumed half"; each half's own footer: replyFooter.test.ts.
  3. UX (the cut half reads as finished and shows its own cost) and the _attach_owned_turn_stats removal are the owners' decisions; nothing further from the author on either. For the removal, the description's "Decision for the owner" has the case: its one production caller passed reply_mids=None, the test moved to _attach_turn_stats, and the name comes back as a one-line alias if you want it kept. I can file the "continues below" cue as an issue if you want one linked.

CI is green on this head; nothing else is pending on my side.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at fc154b5.

The author answered the two technical items from our r114 hold, and the replies hold up. The First Principles disposition keeps the CancelledError swallow on the shutdown save (turn_reply_seams.py#L137-L157), which matches _persist_abnormal_turn_usage, and a test fails when it is narrowed. The Design disposition names server and client tests for the mid-keyed footer patch and for collapse-all.

Two owner decisions still block approval:

  • UX: a cut half draws a full footer under a broken sentence, and Copy/Fork on it take half the answer. Not a goal declines a "continues below" cue. A maintainer needs to accept this. If it is deferred, link an issue for the cue in the description.
  • Removing _attach_owned_turn_stats: a maintainer comment accepting the removal clears it.

CI is green, and the GPT and Opus lanes have no findings on this head.

— crew-pr-reviewer (r116)

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 0a7cd15.

This head is a rebase of fc154b5 that folds _attach_owned_turn_stats into _attach_turn_stats. The seam our r116 accepted is unchanged: the footer is stamped before the shutdown save, and that save swallows a cancel the way the usage write does (turn_reply_seams.py#L143-L170). CI is green and the GPT and Opus lanes have no findings.

What still holds it:

  1. Owner decisions, unchanged since r116. A maintainer must accept that the cut half of a resumed reply draws a full footer and its own cost (UX), or you link an issue for the "continued below" cue. A maintainer must also accept removing _attach_owned_turn_stats.
  2. Two notes on this head have no reply:
    • Opus: the feature-map row says chat_runner.py stamps through _persist_partial_reply. It does not; the callers are chat_turn/acp_recovery.py, stop_recovery.py and turn_failures.py. Please fix the row.
    • Design: point to a backend test that only _last_reply_row / _completed_reply_row receive turn_stats, or say why none is needed.

Nothing was run locally.

— crew-pr-reviewer (r125)

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at f677e3c, for one owner decision.

Both notes from my r125 hold are fixed on this head. The feature-map row now names the real callers of _persist_partial_reply. A new scan in test_turn_stats.py pins every turn_stats write to _completed_reply_row or _last_reply_row. The seam accepted at r116 is unchanged, all AI lanes pass and CI is green. Removing the private _attach_owned_turn_stats no longer needs a ruling: its only caller is rewritten.

What still holds it: the UX lane still notes that the cut half and the resumed half of one answer each show their own footer and cost, with no cue that they belong together. The description declines the cue and files no issue. A maintainer comment accepting that design clears this, or you can link an issue for the cue or combined cost.

— crew-pr-reviewer (r127)

The backend stamps meta.turn_stats on every abnormal end, but a reply
still lost its footer, the model / credits / elapsed line and the Copy /
Fork / More actions alike. A reply followed by an auto-nudge cycle lost
it whole: the chat page's footer walk returned at the next reply before
it read the reply's own stats, the SDK renderer's copy never read them,
and both counted only a user row as the end of a turn, so the recovered
answer under a cut reply hid that reply's footer the same way, and a
queued recovery sends no chat_done, so the page never received the stamp
before the recovery finished. A gateway restart mid-turn saved the cut
reply before the seam attached its footer. A window at its cap shifted
the boundary index the stamp scanned from, so the reply got none. A
recovery arm after a completion that reported no billing gave the footer
the completion's empty figures while the usage row took the provider's
live read. A failure inside the seam's text save, or a cancel on its
shutdown save, propagated into the recovery arm and cost it its card and
its recovery. A synthesis answer an error cut short carried stats on its
first half, so the grouper folded the resumed half behind the next wave.
And a reply cut short and resumed in one turn had its first half, the
row the footer sits on, folded as a working step by the collapse-all
split, so the reader got a sentence that starts mid-thought.

Decide the footer in one function both surfaces call with the row they
draw: a reply carrying stats keeps its footer whatever is drawn below
it, and a row that opens a turn of its own ends the turn above it. Send
the stats to open clients at once on the chat_message_update patch. Put
the footer on before the shutdown save, mark the slot dirty for it, and
write it once per turn, from the completion's figures, ttft included,
when the completion billed the turn, else from the seam's one billing
read, which the usage row then shares. Find the reply through the one
identity walk the file-chip flush uses too, scoped by the turn's start
row, passing over a system notice; the completed turn's attach takes the
same walk, and the explicit-list wrapper it was the only caller of goes.
Swallow a cancel on the seam's shutdown save, as its usage write does. A
synthesis answer an error cut short ends with the card and notices that
report on its turn, or at the resumed half when a recovery resumed it.
Keep a stamped reply a recovery resumed, and the recovery row, out of
the collapse-all fold, as the answer before a tool-refusal card already
is, and with them the synthesis row that led the cut reply, the one
step that turn would otherwise fold; text a tool call followed still
folds, and so does a cut reply with no stamp.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

The fix is sound. One shared rule, replyShowsFooter, decides the footer for the chat page and the SDK. A reply with positive turn_stats always keeps its footer, and a reply without stats waits for a user row or a row that opens a turn of its own (

export function replyShowsFooter(m: ChatMessage, messages: readonly ChatMessage[], index: number, running: boolean): boolean {
if (m.role === 'streaming') return false
const stats = m.meta?.turn_stats as Partial<TurnStats> | undefined
if (typeof stats?.elapsed_ms === 'number' && stats.elapsed_ms > 0) return true
for (let j = index + 1; j < messages.length; j++) {
const later = messages[j]
if (later.role === 'user' || opensTurn(later)) return true
if (isHiddenInvisibleAssistantRow(later) || isSystemNoticeRow(later)) continue
if (later.role === 'assistant' || later.role === 'streaming') return false
}
return !running
}
). This replaces two copies of a walk that treated only a user row as a turn end.

On the backend, _stamp_abnormal_turn_footer stamps the reply before the shutdown save, takes the one billing read, and reuses it for the usage row (

# The footer goes on before the shutdown save below, so a restart shows
# it too. It takes the turn's one billing read, which the usage row at
# the end reuses; the read is synchronous, so the order "text first,
# usage write last" still holds. Guarded because it runs ahead of that
# save: a raise in the billing read costs the footer and the row, and must
# not also cost the text its save at shutdown.
try:
_stamped, _billing = _stamp_abnormal_turn_footer(turn)
except Exception:
logger.debug("Stamping the reply footer failed for slot %s", slot.key, exc_info=True)
_stamped, _billing = False, None
if (rows_changed or _stamped) and _gateway_shutdown_requested(state):
# The graceful save ran before these rows changed (this text's row, its
# footer, or a row the held run just went back on, which can happen with
# no text after the last tool call or approval prompt), and the turn's
# teardown skips its own save while the process is going away, so
# without this the change dies with the process. Saved with the
# in-flight marker still set: the next start shows this text with its
# interruption row and the Resume button. Before the usage write and
# the recovery rows below, so the restart reconciles exactly the text
# the user watched stream.
try:
await save_slot_off_loop(
state,
slot,
force=True,
expected_history_key=slot_history_key(slot),
expected_slot_name=slot.key,
)
except (Exception, asyncio.CancelledError):
# A cancel delivered on this await is swallowed for the reason
# _persist_abnormal_turn_usage swallows one: re-raised, it skips
# the usage row below and the calling arm's card and recovery.
logger.debug("Saving the partial reply at shutdown failed", exc_info=True)
# The usage row is written whether or not the turn produced partial text
# -- a turn cut after many tool calls bills credits with no final
# assistant segment -- so it sits outside the ``assistant_text`` guard.
,
def _stamp_abnormal_turn_footer(turn) -> tuple[bool, tuple[TurnUsage, int] | None]:
"""Give an abnormally ended turn's reply its footer, and take its billing read.
Returns whether this call put a footer on, and the billing the usage row
is still owed: ``None`` once the row is written, or when the client is
gone. The inner handle (``slot._acp_client``) is read only to gate on
liveness -- it is the ref ``_turn_release_handles`` drops, so a non-None read
means the credits are still reachable. Synchronous, so the caller can run it
ahead of the shutdown save.
"""
_ttft_visible = turn._ttft_visible
slot = turn.slot
if turn._turn_usage_persisted:
# Only the figures EVENT_COMPLETE captured are attached here, once
# (``_turn_footer_attached``, which a stamp from the seam's own live
# read also sets), and only to this turn's rows: a turn without a
# boundary has no rows of its own to stamp.
if not (
turn._turn_stats_captured and turn._turn_boundary_set and not turn._turn_footer_attached
):
return False, None
# EVENT_COMPLETE billed this turn and was then cut off before its own
# end-of-turn attach: the ceiling's native stop was acknowledged, so
# the turn completed as ``cancelled``, and the task cancel that
# follows landed on an await in between; or a recovery arm returns
# before reaching it. The row is written, so the seam must not read or
# bill again; the reply still gets its footer, from the figures that
# row was billed with.
stamped = _attach_abnormal_turn_stats(
turn,
TurnUsage(credits=turn._turn_credits, cost_usd=turn._turn_cost_usd),
turn._turn_elapsed_ms,
model=turn._turn_model,
ttft_ms=_ttft_visible.ms,
)
return stamped, None
if slot._acp_client is None:
return False, None
_elapsed_ms = int((time.monotonic() - turn._turn_t0) * 1000)
# Read the turn's billing ONCE: ``provider_last_turn_usage`` consumes the
# accumulated multi-attempt total, so a second read for the footer would
# see only the last attempt. The row and the footer share this value.
_usage = provider_last_turn_usage(turn.client, since=turn._turn_stats0)
if not turn._turn_boundary_set or turn._turn_footer_attached:
# A turn that ends before dispatch has no boundary yet, and attaching
# then would overwrite the previous turn's footer, so it writes only
# the row; a reply that already has its footer keeps it.
return False, (_usage, _elapsed_ms)
# However the turn ended -- a Stop press, an error, a transient retry such
# as a model at capacity, a stall recovery, an involuntary cancel -- the
# reply it leaves is one the user read: give it the same footer a
# completed turn gets, so the model that served it and what it cost are
# visible where the turn ended, and a recovery or a later turn drawn below
# it does not take the reply's footer away.
return _attach_abnormal_turn_stats(turn, _usage, _elapsed_ms), (_usage, _elapsed_ms)
). It marks the slot dirty and sends the stats on the mid-keyed chat_message_update patch before a queued recovery runs (
def _broadcast_turn_stats(
state: "DashboardState", slot: "_ChatSlot", row: dict[str, Any], stats: dict[str, Any]
) -> None:
"""Send the footer just put on ``row`` to open clients.
A turn that ends delivers its footer through the refresh its ``chat_done``
triggers. An abnormal end can hand the slot straight to a queued recovery,
which sends no ``chat_done`` until it finishes, so the stats go out on the
``chat_message_update`` patch, which the client merges into the row's meta.
Keyed on the row's ``mid`` where it has one, since two rows can share a
``ts``. Best-effort: a client that misses it reads the stats from the next
refresh.
"""
meta = row.get("meta")
mid = meta.get("mid") if isinstance(meta, dict) else None
ts = str(row.get("ts") or "")
if not ts and not (isinstance(mid, str) and mid):
return
payload: dict[str, Any] = {"slot": slot.key, "ts": ts, "meta": {"turn_stats": stats}}
if isinstance(mid, str) and mid:
payload["mid"] = mid
try:
state.broadcast_ws("chat_message_update", payload)
except Exception:
logger.debug("Broadcasting the reply footer failed for slot %s", slot.key, exc_info=True)
). The footer and the file chips now share one row walk, _last_reply_row, which skips system notices and other writers' envelopes (
def _last_reply_row(
slot: "_ChatSlot", turn_boundary: int, turn_start_mid: str | None
) -> dict[str, Any] | None:
"""The last reply row the runner appended this turn, or None when it appended none.
The one identity walk, which ``_attach_file_changes`` also calls to place the
turn's file chips: only rows this turn appended (``_turn_rows``), and among
them only a reply the runner recorded (``slot._turn_reply_mids``), because
an assistant row another writer injects mid-turn, such as a workflow or
sub-agent completion envelope, is not this turn's reply. A system notice
(``is_system_notice``: a compaction or session-reload status row) is written
under the assistant role but is not a reply either: a failed compaction
appends its notice after the text the user read. A slot that tracks no
identities (a test double without the list) keeps the position rule.
"""
reply_mids = getattr(slot, "_turn_reply_mids", None)
for m in reversed(_turn_rows(slot, turn_boundary, turn_start_mid)):
if m.get("role") != "assistant" or is_system_notice("assistant", m.get("meta")):
continue
if isinstance(reply_mids, list) and row_mid(m) not in reply_mids:
continue
return m
return None
def _completed_reply_row(
slot: "_ChatSlot", turn_boundary: int, turn_start_mid: str | None
) -> dict[str, Any] | None:
"""The row a completed turn's footer lands on.
``_last_reply_row`` once the runner recorded a reply this turn, so a workflow
or sub-agent envelope another writer appended after the reply does not take
the turn's figures. A turn that recorded none keeps the position rule, the
newest assistant row of the turn that is not a system notice: a slash
command's confirmation is appended as a plain assistant row, and a slot
double built without the list records nothing.
"""
reply_mids = getattr(slot, "_turn_reply_mids", None)
if isinstance(reply_mids, list) and reply_mids:
return _last_reply_row(slot, turn_boundary, turn_start_mid)
for m in reversed(_turn_rows(slot, turn_boundary, turn_start_mid)):
if m.get("role") == "assistant" and not is_system_notice("assistant", m.get("meta")):
return m
return None
). Our earlier holds are answered on this head: the cancel swallow on the shutdown save mirrors _persist_abnormal_turn_usage and has a test, the mid ordering and collapse-all are tested, the feature-map row is fixed, and the turn_stats placement scan exists. The rebase from f677e3c only follows main's renames (_attach_file_changes, _flush_file_changes_off_loop). The old source-scan tests became behaviour tests of replyShowsFooter and were not weakened.

AI findings judged non-blocking:

  • UX: the two halves of a resumed answer each draw a full footer, so the first figure can read as the whole cost. each half is its own usage row and its footer is accurate for that row; the error card sits between the halves, and a 'continued below' cue is a declined option, not a promised follow-up (
    function findResumedReplyRows(items: TurnItem[]): ReadonlySet<TurnItem> {
    const rows = new Set<TurnItem>()
    items.forEach((it, i) => {
    if (it.kind !== 'single' || !isRecoveryInjection(it.msg)) return
    let k = i - 1
    while (k >= 0) {
    const between = items[k]
    if (between.kind !== 'single' || !(isTurnStatusRow(between.msg) || isEnvelopeRow(between.msg))) break
    k--
    }
    const cut = k >= 0 ? items[k] : undefined
    if (cut?.kind === 'single' && isTurnEnd(cut.msg)) {
    rows.add(cut)
    rows.add(it)
    const lead = items[k - 1]
    if (lead?.kind === 'single' && isSynthesisInjection(lead.msg)) rows.add(lead)
    }
    })
    return rows
    }
    /** The rows a turn pins out of the collapse-all fold on top of `isVisibleInline`:
    * an answer and the tool-refusal card that followed it, and a reply cut short
    * and resumed with the recovery row that resumed it and the synthesis row
    )
  • UX: this lane has no blind reader. a note about the review process; nothing in the code to change (
    export function replyShowsFooter(m: ChatMessage, messages: readonly ChatMessage[], index: number, running: boolean): boolean {
    if (m.role === 'streaming') return false
    const stats = m.meta?.turn_stats as Partial<TurnStats> | undefined
    if (typeof stats?.elapsed_ms === 'number' && stats.elapsed_ms > 0) return true
    for (let j = index + 1; j < messages.length; j++) {
    const later = messages[j]
    if (later.role === 'user' || opensTurn(later)) return true
    if (isHiddenInvisibleAssistantRow(later) || isSystemNoticeRow(later)) continue
    if (later.role === 'assistant' || later.role === 'streaming') return false
    }
    return !running
    }
    )
  • Design: keep the AST allow-list in test_turn_stats_lands_only_on_the_row_the_two_selectors_chose strict. advice for future edits; the scan exists and is strict on this head (
    def test_turn_stats_lands_only_on_the_row_the_two_selectors_chose() -> None:
    )
  • Design: split case 6 (collapse-all pin, synthesis answer end) into its own commit for a clean revert. packaging preference; case 6 is in the stated Goal and is tested in TurnBlock.test.tsx and groupDisplayItems.test.ts (
    function answerEndIndex(items: readonly TurnItem[]): number {
    let end = -1
    let resumed = false
    for (let k = 0; k < items.length; k++) {
    const t = items[k]
    if (t.kind !== 'single') continue
    if (end < 0 || resumed) {
    if (isTurnEnd(t.msg)) { end = k; resumed = false }
    continue
    }
    if (isRecoveryInjection(t.msg)) { resumed = true; continue }
    if (isTurnStatusRow(t.msg)) { end = k; continue }
    if (isEnvelopeRow(t.msg)) continue
    if (t.msg.role === 'assistant' || t.msg.role === 'streaming' || t.msg.role === 'inject') return end
    }
    return resumed ? -1 : end
    }
    )

GPT and Opus report no findings, and UX, Design and First Principles are PASS. All checks on this head are green, the branch merges cleanly with main, and no change request is active.

Reviewed head: c7cd586

— crew-pr-reviewer (r136)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reply loses its footer (model, credits, Copy/Fork) when its turn ends early or an auto-nudge follows

3 participants