Skip to content

refactor(site): render live assistant output as a chat timeline row - #28079

Open
DanielleMaywood wants to merge 2 commits into
mainfrom
feat/agents-message-reconciliation
Open

refactor(site): render live assistant output as a chat timeline row#28079
DanielleMaywood wants to merge 2 commits into
mainfrom
feat/agents-message-reconciliation

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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 into MessageBlocks, the streaming/durable assistant split collapses into a shared AssistantOutput, and LiveStreamTail shrinks to the empty state and terminal failure callout. Row keys are plain message:<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
  • Extract BlockList and friends from ConversationTimeline into MessageBlocks (pure move).
  • Replace StreamingOutput with AssistantOutput, used for both live and durable assistant rows.
  • Render the live assistant as a timeline row via assignTimelineRows instead of separate transient content below the transcript.
  • Keep existing transcript grouping, prompt navigation, and the current scroll container unchanged; the scroller swap happens in feat(site): migrate agent chat scrolling #28130.

Generated by Coder Agents on behalf of @DanielleMaywood.

@github-actions

Copy link
Copy Markdown

Docs preview

Check 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.

@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-message-reconciliation branch from 99841e4 to b00f9d6 Compare August 12, 2026 22:11
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread site/src/pages/AgentsPage/AgentChatPage.tsx Outdated
Comment thread site/src/pages/AgentsPage/AgentChatPage.tsx Outdated
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-message-reconciliation branch from b00f9d6 to 870702b Compare August 13, 2026 12:14
@DanielleMaywood DanielleMaywood changed the title fix: reconcile agent chat messages refactor(site): stabilize agent chat message rows Aug 13, 2026
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-message-reconciliation branch from 9330870 to 61d241a Compare August 13, 2026 16:51
@DanielleMaywood
DanielleMaywood force-pushed the feat/agents-message-reconciliation branch from 61d241a to ec12b85 Compare August 13, 2026 17:05
@DanielleMaywood DanielleMaywood changed the title refactor(site): stabilize agent chat message rows refactor(site): render live assistant output as a chat timeline row Aug 13, 2026
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

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".

@DanielleMaywood
DanielleMaywood marked this pull request as ready for review August 13, 2026 21:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +805 to +808
const renderRows = assignTimelineRows(
displayMessages,
Boolean(liveStatus && shouldRenderLiveAssistant(liveStatus)),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant