Skip to content

refactor(site/src/pages/AgentsPage): require always-passed chat input props - #29890

Merged
DanielleMaywood merged 3 commits into
mainfrom
nullability/chat-input
Oct 6, 2026
Merged

DanielleMaywood merged 3 commits into
mainfrom
nullability/chat-input

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

AgentChatPage always passes every model, plan mode, workspace loading, urlTransform and plan/question handler prop to AgentChatPageView and AgentChatPageLoadingView, and AgentChatPageView always passes the editor, MCP and loading props to ChatPageInput and ChatPageTimeline. AgentChatInput has three production callers (AgentCreateForm, ChatPageInput, the loading view), and all of them pass initialValue, onContentChange, planModeEnabled, onPlanModeToggle and isModelCatalogLoading. AgentChatInput is the only renderer of ChatMessageInput and AttachmentPreview, and ChatMessageInput is the only renderer of SkillsTriggerMenu, and it always passes their callbacks and flags. The receiving components still declared all of these optional, so their = false defaults, ?.() calls, onPlanModeToggle && / onRemoveMcp && guards and ?? "" fallbacks were dead.

These props are now required and the dead handling is gone. The plan mode menu item, the inline planning badge's dismiss button and the MCP badge dismiss button now render unconditionally. ChatMessageInput always received autoFocus, so that prop is removed and AutoFocusPlugin always renders. ChatPageInputProps.inputRef is narrowed to RefObject, matching the loading view. Tests and stories now pass the values production sends. The PlanningIndicatorWithoutToggle story covered a state production cannot reach and is removed, and the ChatMessageInput test that ran without onChange is renamed to describe what it still checks (getValue after insertText).

Props that stay optional on purpose: AgentChatInput MCP, inputRef, remountKey, unsupportedProviderNames and onReasoningEffortChange, which the loading view or AgentCreateForm omit. ChatPageTimeline onImplementPlan/onSendAskUserQuestionResponse/onEditUserMessage, which are undefined for read-only viewers. ToolBadge.onRemovePlanning, because MCPGroupBadge renders ToolBadge for MCP servers without it, so the planning badge keeps its onRemovePlanning && guard. AgentChatInput manageAutomationsEnabled/onManageAutomationsToggle, which callers omit when the automations experiment is off or the viewer cannot toggle it. ChatMessageInput.ref, which follows React's optional ref convention and has no guard to delete. AttachmentPreviewFrame.href matches the cluster regex but lives in AttachmentBlocks.tsx, which is owned by the timeline cluster.

This branch also carries #29905 (non-null context usage in ContextUsageIndicator) and #29907 (dead chat page null checks), which were merged into it as their own commits.

Part of the AgentsPage nullability cleanup; see #29888 for the methodology. Dead slots for this cluster: 59 before, 2 after (both intentional skips).

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

@DanielleMaywood
DanielleMaywood marked this pull request as ready for review September 25, 2026 10:55
@DanielleMaywood
DanielleMaywood requested a review from a team as a code owner September 25, 2026 10:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T10:57:46.193455Z b008dba Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@linear-code

linear-code Bot commented Sep 30, 2026

Copy link
Copy Markdown

CODAGT-1258

… props

AgentChatPage, AgentChatPageView, ChatPageContent, AgentCreateForm
and AgentChatInput always pass the composer, page shell, attachment
preview and skills menu props below, but the receiving components
still declared them optional and defaulted or guarded them.

Make them required and drop the dead defaults and guards:
AgentChatPageView and its loading view props, ChatPageTimeline and
ChatPageInput editor, MCP and loading props, AgentChatInput
initialValue/onContentChange/plan mode/catalog loading,
ChatMessageInput, SkillsTriggerMenu and AttachmentPreview callbacks
and flags. ChatMessageInput always autofocuses, so its autoFocus prop
is removed. Tests and stories now pass the values production sends;
the story for plan mode without a toggle handler is removed.
@DanielleMaywood
DanielleMaywood merged commit 82629f2 into main Oct 6, 2026
27 checks passed
@DanielleMaywood
DanielleMaywood deleted the nullability/chat-input branch October 6, 2026 12:30
DanielleMaywood added a commit that referenced this pull request Oct 6, 2026
… transform in timeline (#29894)

Stacked on #29890, which makes `ChatPageTimelineProps.organizationId`,
`urlTransform` and `mcpServers` required. With that in place, every
production path into the timeline passes these three values, so this PR
narrows them on `ConversationTimeline`, `ChatMessageItem`,
`LifecycleHookNotice`, `BlockList`, `ReasoningDisclosure`,
`ResponseBlock` and `Tool`. `ToolRendererProps` keeps them optional
because renderers are looked up dynamically.

Stories and tests now pass `"organization-id"`, an empty MCP server
list, and streamdown's `defaultUrlTransform`, which is what they
rendered with when the props were omitted.

These are the 14 dead slots that #29891 left behind because they
depended on #29890. This PR clears all 14. Part of the AgentsPage
nullability cleanup; see #29888 for the methodology.

---

_This PR was generated by Coder Agents on behalf of @DanielleMaywood._
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants