refactor(site): render live assistant output as a chat timeline row - #28079
refactor(site): render live assistant output as a chat timeline row#28079DanielleMaywood wants to merge 2 commits into
Conversation
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
99841e4 to
b00f9d6
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b00f9d646e
ℹ️ 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".
b00f9d6 to
870702b
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9330870eff
ℹ️ 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".
9330870 to
61d241a
Compare
61d241a to
ec12b85
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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: ec12b85c2f
ℹ️ 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".
| store, | ||
| selectIsAwaitingFirstStreamChunk, | ||
| ); | ||
| const streamState = useChatSelector(store, selectStreamState); |
There was a problem hiding this comment.
Isolate stream subscriptions from the transcript parent
During active chats, every token or tool delta replaces streamState, so this new subscription rerenders ChatPageTimeline and passes a changing prop into ConversationTimeline, making the full historical timeline participate in every streamed update. The previous LiveStreamTail isolated these high-frequency updates; with long transcripts or fast streams, the new arrangement can cause visible token-streaming lag. Keep the stream selectors in a dedicated live-row child rather than the component that owns the durable transcript.
AGENTS.md reference: site/AGENTS.md:L251-L255
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not fixing, with evidence. We spiked the actual compiler output for this exact code (babel-plugin-react-compiler 1.0.0, applied to src/pages/AgentsPage in production, dev, and vitest builds). The compiled ChatPageTimeline guards the entire transcript derivation (parseMessagesWithMergedTools, buildSubagentMaps, buildDisplayMessages) behind identity checks on orderedMessageIDs / messagesByID / chatStatus, none of which change on a stream token (applyMessageParts only replaces the streamState slice). Per text token the marginal cost is one ChatPageTimeline render, a trivial deriveLiveStatus/buildStreamTools recompute, one ConversationTimeline element allocation, and a memo shallow-compare that passes. Durable ChatMessageItem rows do not re-render. All relevant functions show CompileSuccess, and the repo's lint:compiler gate (392 functions compiled, 0 diagnostics) fails CI if a future change makes any of them bail.
The one soft spot is a data-flow property the compiler cannot enforce: if a future change bumps orderedMessageIDs/messagesByID identity per token, the guards fire and the regression returns. Worth keeping in mind when touching the store reducers.
Generated by Coder Agents on behalf of @DanielleMaywood.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec12b85c2f
ℹ️ 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".
| const renderRows = assignTimelineRows( | ||
| displayMessages, | ||
| Boolean(liveStatus && shouldRenderLiveAssistant(liveStatus)), | ||
| ); |
There was a problem hiding this comment.
Cover the live timeline-row integration in Storybook
This changes the user-visible placement and lifecycle of streaming output, but the new stories render AssistantOutput directly and therefore bypass assignTimelineRows and ConversationTimeline; the only coverage for the new row assignment is a pure unit test. Add a Storybook play scenario that renders the actual timeline with durable and live content and verifies the live row's ordering and replacement when the response becomes durable.
AGENTS.md reference: site/AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not fixing in this PR. The integration is covered one PR up the stack: AgentChatPageView.stories.tsx (StreamCompletionKeepsViewportPosition) drives a real store through the full lifecycle, asserting chat-message-live-assistant mounts as the live row and is replaced by chat-message-message:42 when the durable message lands. Since these two PRs merge as a stack, adding a second, lower-fidelity story here would duplicate that coverage.
Generated by Coder Agents on behalf of @DanielleMaywood.
Refactor the Agents chat timeline so live assistant output renders as a timeline row through the same components as durable messages, ahead of the stacked MessageScroller migration in #28130.
ConversationTimeline's block rendering is extracted intoMessageBlocks, the streaming/durable assistant split collapses into a sharedAssistantOutput, andLiveStreamTailshrinks to the empty state and terminal failure callout. Row keys are plainmessage:<id>strings; the live assistant row is a separate ephemeral row. This PR does not change scrolling behavior and adds no backend, API, or database fields.Implementation notes
BlockListand friends fromConversationTimelineintoMessageBlocks(pure move).StreamingOutputwithAssistantOutput, used for both live and durable assistant rows.assignTimelineRowsinstead of separate transient content below the transcript.Generated by Coder Agents on behalf of @DanielleMaywood.