Files
coder/site
Danielle Maywood 9bc681fa6e fix(site/src/pages/AgentsPage/components/ChatElements/tools): delete unreachable switch arms from ToolLabel and ToolIcon (#27697)
Deletes unreachable switch arms from `ToolLabel` (14 arms) and
`ToolIcon` (1 arm). No behaviour change; the deleted arms could never be
reached, so the rendered output is identical.

## Reachability proof

`ToolLabel` has exactly two call sites:

1. `Tool.tsx` `GenericToolRenderer` (line 950), reached when a tool name
has no `toolRenderers` entry or when its registered renderer delegates
to `GenericToolRenderer`.
2. `AdvisorTool.tsx` (line 72), which hardcodes `name="advisor"`.

Dispatch in `Tool.tsx`: subagent names (`spawn_agent`, `wait_agent`,
`message_agent`, `interrupt_agent`, plus legacy `spawn_subagent`,
`close_agent`) route to `SubagentRenderer`; everything else hits
`toolRenderers[name] ?? GenericToolRenderer`. None of the subagent names
appear in either switch.

Every registered renderer was checked for delegation:

| ToolLabel arm | Shadowing renderer | Delegates? |
| --- | --- | --- |
| `execute` | `ExecuteRenderer` -> `ExecuteTool` | No |
| `process_output` | `ProcessOutputRenderer` -> `ProcessOutputTool` | No
|
| `read_file` | `ReadFileRenderer` -> `ReadFileTool` | No |
| `write_file` | `WriteFileRenderer` -> `WriteFileTool` | No |
| `edit_files` | `EditFilesRenderer` -> `EditFilesTool` | No |
| `create_workspace` | `CreateWorkspaceRenderer` ->
`CreateWorkspaceTool` | No |
| `start_workspace` | `StartWorkspaceRenderer` -> `StartWorkspaceTool` |
No |
| `list_templates` | `ListTemplatesRenderer` -> `ListTemplatesTool` | No
|
| `read_template` | `ReadTemplateRenderer` -> `ReadTemplateTool` | No |
| `read_skill` | `ReadSkillRenderer` -> `ReadSkillTool` | No |
| `read_skill_file` | `ReadSkillFileRenderer` -> `ReadSkillTool` | No |
| `chat_summarized` | `ChatSummarizedRenderer` -> `ChatSummarizedTool` |
No |
| `propose_plan` | `ProposePlanRenderer` -> `ProposePlanTool` | No |
| `computer` | `ComputerRenderer` -> `ComputerTool` | No |

Kept arms:

- `process_signal`: `ProcessSignalRenderer` IS a registry key but
delegates to `GenericToolRenderer`, so the arm stays reachable. Kept.
- `advisor`: hardcoded by `AdvisorTool.tsx`. Kept.
- `process_list`, `attach_file`: no registry entry, not subagent names,
so they fall through to `GenericToolRenderer`. Kept.
- `default`: covers MCP tools and any unregistered name. Kept.

`ToolIcon` is rendered by `ToolCall.LeadingIcon` / `ToolCall.Header
iconName`, and every dedicated per-tool component passes its own fixed
name (`execute`, `process_output`, `read_file`, `write_file`,
`edit_files`, `list_templates`, `read_template`, `read_skill`,
`chat_summarized`, `ask_user_question`, `propose_plan`, `computer`,
`start_workspace`, `list_agents`, `create_workspace`, `advisor`), so
those arms are reachable and kept. `thinking` is passed directly from
`StreamingOutput.tsx` and `ConversationTimeline.tsx`, and
`chat_summarized` covers `list_agents` via the shared `BotIcon` arm.
`read_skill_file` is the only arm whose renderer
(`ReadSkillFileRenderer`) renders `ReadSkillTool` with the hardcoded
`iconName="read_skill"`, so nothing ever passes `read_skill_file` to
`ToolIcon`. That arm alone is deleted.

No exports, helpers, or imports became dead (verified with knip, which
passes clean).

## Delta and tests

- Line delta: -119 (ToolLabel -118, ToolIcon -1), 0 insertions.
- Unit (`--project=unit src/pages/AgentsPage`): 1500 passed, 2 skipped
before and after.
- Storybook (`--project=storybook src/pages/AgentsPage`): 949 passed, 2
failed before and after, identical failures both runs:
`AgentChatPageView.stories.tsx > Scroll To Bottom Button Works With
Inverse Scroll` and `Tool.stories.tsx > MCP Tool Completed`. Both
reproduce on unmodified main (MCP Tool Completed also fails in isolation
on main), so they are pre-existing and unrelated.
- `tsc --noEmit`, `biome check --error-on-warnings`, and knip all pass.

Generated by Coder Agents.
2026-07-30 22:58:57 +01:00
..
…
…
…
…