Repository navigation
fix: fold web searches, answer reasoning, and OpenAI narration into working blocks - #30529
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bf0b4dd2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 856c862499
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00f9320973
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 769a8aa9c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cb255e976
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11c77eb883
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…er-row reasoning and web search into working blocks With Collapse assistant steps on, the final answer row's reasoning and web search sources rendered after the Worked for block, and rows ending in sources split blocks. An answer row that did work now joins the block it ends: its reasoning, tools, and sources fold in, and its answer text renders right after the block. Web search result groups count as steps. Tool-less turns keep their reasoning visible.
…ess frontend review of working block answer split Rename the ChatMessageItem part prop to section with one RowSection type, inline single-use values, trim comments, use example.com fixture URLs, and add a story for a tool-less turn whose answer searched the web.
…ation before an answer's web search into its working block An answer row now splits at its last work step, so text that precedes a provider web search folds with the step instead of rendering after the block as answer text.
…lify working block answer split Share RowSection with splitRowBlocks via satisfies instead of a widened return type, drop the off-by-one answerStart offset, tighten comments, and wait for the streamed answer in the AnswerStreamsAfterBlock story.
…e answer split around working blocks Assert that an answer's narration, reasoning, and web search stay inside the collapsed block and render inside it when expanded, that the answer stays inert while an earlier prompt is edited, and that live answer text streams outside the block while its reasoning stays mounted.
…tions from splitting a streaming answer OpenAI's Responses API streams url_citation annotations between the answer's text deltas, and chatd publishes each one as a live source part, so a streaming answer arrived as text, sources, text. splitRowBlocks treated those sources as the answer's last step and folded the text before them into the working block until the message persisted. Only the last reasoning or tool call now bounds the answer; sources still fold, and hidden blocks stay in the work section. Vitest no longer asserts DOM presence, order, or the inert attribute (FE1). The copy test checks only the clipboard payload, the split rules gained pure-function tests, and the story EditingBeforeAnswerWorkFolds captures the answer dimming itself while an earlier prompt is edited.
…ation before web searches Text a model writes before a provider-executed web search is narration, but the parser and the stream builder dropped those calls, so a turn without reasoning rendered its lead-in after the working block as the first paragraph of the answer. Both now mark the text before the call, and the row split treats the mark as the narration boundary. Searches count as steps by their provider-executed results instead of their citation groups. In a turn without tools, a live OpenAI block otherwise vanished when the answer started and came back at the first citation, and a search without citations counted as no step. Answer text merges only across citations, never across hidden tools or file references.
…answer's uncited web search An answer whose only work was a web search without citations did not join the block it ends, so the block's step count and duration left the search out. It now joins, and its empty work section renders nothing inside the block. A row that shows no work still never starts a block, so a turn whose only work is such a search renders as before instead of as a block that expands to nothing.
… sections without visible blocks The empty work section guard now uses the same visibility rule as block membership, so a hidden tool in an answer whose only other work was an uncited search no longer leaves an empty row inside the block.
…e answer story plays at expanding the block The AnswerStreamsAfterBlock and SearchAnswerStreamsAfterBlock play functions ended with a findByText wait on the streamed answer, which turned them into DOM assertions. Play functions only drive state, so they now reuse expandBlock and leave the rendered answer to Pixel.
An Anthropic web search that found nothing streamed to clients but was dropped when its step was saved: fantasy attached no metadata to the empty result, and chatd's step sanitizer removes provider tool results without it. With working blocks folding web searches, the live block then vanished when the turn ended. Pin the coder/fantasy fix that attaches empty metadata, which replays as an empty result list, and cover the empty case in the persistence test.
coder/fantasy#64 and #65 merged the OpenAI media-batch fix and the Anthropic empty web search fix into coder_2_33, so the pin no longer points at unmerged branches. The new commit's source tree is identical to the previous pin's.
…rches an interrupt commits apart from their row An interrupted turn commits a web search's call and result as separate messages that render no row, so the working block's step count missed the search, and a cited answer after it counted its citations instead. Count provider results across the block's messages, and count citations only when no provider result exists.
…ess frontend review of the interrupted search count Name the live-turn condition, rename the source block counter, and keep only the interrupt test cases that fail without the fix.
…rches that render no row before a block A web search step that renders nothing, persisted between the previous row and a block's first step, was skipped before the block's span, so the block reported one step too few and started its clock too late. Count the provider results of hidden messages since the previous row, and leave the previous row's own results out.
…ess frontend review of the pre-block search count Drop the cursor comment's clause about adjacent blocks; the span comment already states which hidden messages a block counts.
OpenAI Responses models label each assistant message as commentary on their work or as the final answer. fantasy, chatd, and the client dropped the label, so narration streamed below a live working block as if it were the answer and folded into the block only when the next tool call arrived. Follow-up requests also replayed it without the label. Pin coder/fantasy at 351055280157 (coder/fantasy#66), which keeps the label on text parts and replays it. chatd marks commentary text with a new narration field on every stream delta and on saved parts. The client keeps narration and answer text in separate blocks and treats narration as work, so it renders inside the working block from its first delta, and a turn whose only work is narration still gets a block, labeled without a step count.
Name the merge exception in appendTextBlock and the keep condition in groupWorkingBlocks so neither guard stacks negations, correct the narration comment, and drop the provider list from the field doc. Add a story for a turn whose only work is narration, compare replayed phases as values, and send empty end metadata in the chatloop test so a nil check cannot pass it.
…er each working block's span groupWorkingBlocks walked the parsed entries with one shared index cursor and mutable accumulators. Each block now filters the entries in its span, counts provider results with a helper, and maps the span to timestamps. Spans still start where the previous one ended, and a new test checks that a search between two blocks counts once.
301b9c5 to
0c30095
Compare
|
@codex review
|
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes CODAGT-1373.
With Collapse assistant steps on, the "Worked for" block counted a row only when its last visible block was a tool call or reasoning. Final answer messages usually also carry the turn's last reasoning and web search, so "Thinking about ..." and "Searched N results" rendered between the block and the answer, and a message ending in search results split the block in two.
An answer message that also did work now joins the block it ends: its reasoning, searches, and narration before its last tool call or search fold into the block, and only the answer renders after it. Each search counts as one step, even without citations or a row of its own, and citations streamed between text deltas no longer split the answer. Turns without tools, searches, or labeled narration render as before; Copy still copies the whole message. With the preference off, text on either side of a web search now renders as separate paragraphs, where main ran a lead-in into the answer when the search found nothing.
Two provider fixes keep the live and saved views in agreement:
narrationfield onChatMessagePart(stream deltas and saved parts), and the client treats labeled narration as work. A turn whose only work is narration gets a block labeled without a step count.go.mod pins fantasy's
coder_2_33branch at351055280157, which also carries the media-batch fix main had pinned from an unmerged branch (coder/fantasy#64).Screenshots
UAT round 5 frames after reload; main and this PR ran on the same test server.
Anthropic, narration and a web search before the answer:
OpenAI, reasoning and four searches before the answer (one "Searched" row holds all four):
Testing
workingBlockGrouping.test.ts(grouping, the row split, and every streamed prefix against the saved message for each provider part order, labeled narration included),streamState.test.ts,ConversationTimeline.test.tsx. Each recorded mechanism toggle fails a named test (the one survivor on769a8aa9c60gained a test in11c77eb8832).TestActiveServer_AnthropicKeepsPairedWebSearchBeforePersist(searches with no results survive saving),TestProcessStepStreamLabelsNarration, andTestOpenAIResponsesNarrationKeepsPhase(saved narration and phase replay through the database). fantasy tests cover both provider fixes.LabeledNarrationFoldsand the twoWithoutStepslabels..mux-uat/round-N/): round 5 on769a8aa9c60: PASS (Anthropic searches that find nothing through completion, reload, and follow-up replay; OpenAI and the preference-off view as in round 4). Round 6 on301b9c51bbf: FAIL under its criterion that the preference-off view match main exactly: an Anthropic lead-in before a search that found nothing renders as its own paragraph, where main runs it into the answer ("Go 1.21.The search results"). The split is intended (856c8624992) and kept: the text matches main's character for character, and main already breaks there when the search has citations. Re-assessed from the round's evidence against the corrected criterion: PASS after reload; the live preference-off stream was not captured remotely and was checked with a local render probe. Every OpenAI narration check passed: in six runs no frame showed narration outside the block (main showed it in all six), and follow-ups replayed the phases. Rounds 1, 3, and 4 failed; each defect is fixed or listed below. Since round 6 the branch was rebased onto main and gained one refactor of the step-count span (0c300957a21), covered by Vitest; live UAT has not run on the rebased head.Review record
90aa50e9f58,71527c6ac1cwith00f93209730,236410c613c,74a56409562,98ef3b1c35e). Declined: Copy with trailing citations (Copy takes the whole message, as on main) and the live row counting its searches as one (the live label shows no step count). No issues on769a8aa9c60,6d516f0b9b0,301b9c51bbf, or0c300957a21.301b9c51bbfand asked for filters instead of the shared index cursor ingroupWorkingBlocks; done in0c300957a21, with a test that a search between two blocks counts once.ChatMessageItem.