Skip to content

refactor(site/src/pages/AgentsPage): split ChatMessageItem into live and persisted rows - #29900

Closed
DanielleMaywood wants to merge 4 commits into
mainfrom
nullability/chat-message-rows
Closed

DanielleMaywood wants to merge 4 commits into
mainfrom
nullability/chat-message-rows

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #29891.

ChatMessageItem in ConversationTimeline.tsx took one bag of optional props for two modes that never overlap: the live streaming assistant row (liveStatus/liveBlocks/liveTools) and a persisted message row (message/parsed). It is now split into two memoized list items, each with required props for its mode:

  • LiveAssistantRow: liveStatus, liveBlocks, liveTools and subagentStatusOverrides are required.
  • PersistedMessageRow: message and parsed are required, along with the props the callsite always passes (the booleans, editingMessageId, onEditUserMessage, onJumpToUserMessage, the ask-question props). displayState is always derived, so the displayState &&/?. checks, parsed?/&& parsed, message?., messageId !== undefined, the parsed?.blocks ?? liveBlocks fallbacks and the = false/= [] defaults go away.

Both rows render the wrapper div through a shared MessageRowFrame, so the DOM, row keys and data-testid="chat-message-live-assistant" are unchanged. The image and text preview state moves up to ConversationTimeline, which renders one ImageLightbox and one TextPreviewDialog and passes the setters to both rows. Rows no longer hold state, and an open preview no longer closes if its row re-renders or unmounts. The dialogs are portalled, so where they sit in the tree does not affect the DOM. prevUserMessageKey/nextUserMessageKey stay optional because the first and last user rows have no neighbor.

Expect a conflict with #29894 (nullability/timeline-org-mcp-url), which edits the same props and both callsites to make organizationId/urlTransform/mcpServers required. This PR leaves those props untouched so the rebase stays mechanical.

Verified: pnpm lint:types, pnpm check, pnpm lint:oxlint, pnpm lint:compiler, pnpm lint:knip, pnpm test src/pages/AgentsPage, and pnpm test:storybook on the ConversationTimeline, LiveStreamTail, TerminalStatusRow, ChatPageContent, AgentChatPage and AgentChatPageView stories. A new UserMessageImageOpensLightbox story checks that clicking an image opens the timeline-level lightbox.

Part of the AgentsPage nullability cleanup; see #29888 for the methodology.

Plan excerpt

Analysed on a local, unpushed merge of all cleanup branches; ranking script topdown.cjs. After the bottom-up PRs only 43 dead slots remain, so what's left is nullability that is real at its origin. Two read-only agents reviewed the top origins in code. Guard counts from the tool overstate the win: many "guards" are real branches (loading, no workspace, first/last row).

# Change Guards removed Size Risk
T3 Split ChatMessageItem into LiveAssistantRow and PersistedMessageRow (the two modes never overlap) ~11 plus derived displayState checks and defaults 1 file / ~120 lines Low; keys already differ, keep memo on persisted row and the live testid

This PR was generated by Coder Agents on behalf of @DanielleMaywood.

@DanielleMaywood
DanielleMaywood force-pushed the nullability/conversation-tools branch 2 times, most recently from 8fd105a to 68e6991 Compare September 29, 2026 14:29
@DanielleMaywood
DanielleMaywood force-pushed the nullability/chat-message-rows branch from e0c5618 to 59c458a Compare September 29, 2026 14:36
@linear-code

linear-code Bot commented Sep 30, 2026

Copy link
Copy Markdown

CODAGT-1258

@DanielleMaywood
DanielleMaywood force-pushed the nullability/conversation-tools branch from 75a2e38 to b074f1b Compare October 6, 2026 08:07
@DanielleMaywood
DanielleMaywood force-pushed the nullability/chat-message-rows branch from 59c458a to 65b3e32 Compare October 6, 2026 09:27
@DanielleMaywood
DanielleMaywood force-pushed the nullability/conversation-tools branch from b074f1b to 15526c0 Compare October 6, 2026 11:12
@DanielleMaywood
DanielleMaywood force-pushed the nullability/chat-message-rows branch from 65b3e32 to b7e4e46 Compare October 6, 2026 11:16
…nd tool props

ChatPageTimeline always passes stream tools, live status, subagent
maps and the stream flags to ConversationTimeline, and every hop
below it (ChatMessageItem, AssistantOutput, BlockList, Tool, the tool
renderers and AttachmentBlock) forwards those values unconditionally.
The optional types, defaults and guards along that path were dead.

Narrow them to required, drop the defaults and `?.`/`??`/`Boolean()`
guards, and remove the `showTextStatus`/`showStatus` attachment props
that every caller set to true. `resolveAgentDisplayState` no longer
accepts an undefined mode, and `useDeadlineCountdown` no longer
accepts an undefined deadline.

Stories and tests now pass the values production sends.
@DanielleMaywood
DanielleMaywood force-pushed the nullability/conversation-tools branch from 15526c0 to 8035d49 Compare October 6, 2026 13:28
…nversationTimeline

Rows no longer own preview state. The timeline holds one image and one
text preview dialog and passes the setters to both row components.
@DanielleMaywood
DanielleMaywood force-pushed the nullability/chat-message-rows branch from b7e4e46 to 8239c76 Compare October 6, 2026 13:30
Base automatically changed from nullability/conversation-tools to main October 6, 2026 13:37
@github-actions github-actions Bot added the stale This issue is like stale bread. label Oct 31, 2026
@github-actions github-actions Bot closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale This issue is like stale bread.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant