fix: use appropriate icons for dynamic tool calls instead of hammer fallback#32
fix: use appropriate icons for dynamic tool calls instead of hammer fallback#32
Conversation
…ead of HammerIcon for dynamic/c
📝 WalkthroughWalkthroughThis pull request centralizes icon resolution logic for work entries by introducing a new public function 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/components/chat/MessagesTimeline.logic.ts`:
- Around line 119-126: The generic haystack.includes("task") check is taking
precedence and can incorrectly return HammerIcon for entries that are actually
dynamic_tool_call or collab_agent_tool_call; update MessagesTimeline.logic by
moving the workEntry.itemType checks for "dynamic_tool_call" and
"collab_agent_tool_call" (WrenchIcon and BotIcon) so they run before the
haystack.includes("task") conditional, ensuring those specific itemType
fallbacks are matched first; keep the existing activityKind checks in place and
preserve return values for ListTodoIcon, HammerIcon, BotIcon, and CheckIcon.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e705b146-c860-4df0-9a11-61ea2c4fc582
📒 Files selected for processing (4)
apps/web/src/components/ChatView.tsxapps/web/src/components/chat/MessagesTimeline.logic.test.tsapps/web/src/components/chat/MessagesTimeline.logic.tsapps/web/src/components/chat/MessagesTimeline.tsx
| if (haystack.includes("task")) return HammerIcon; | ||
|
|
||
| if (workEntry.activityKind === "turn.plan.updated") return ListTodoIcon; | ||
| if (workEntry.activityKind === "task.progress") return HammerIcon; | ||
| if (workEntry.activityKind === "approval.requested") return BotIcon; | ||
| if (workEntry.activityKind === "approval.resolved") return CheckIcon; | ||
| if (workEntry.itemType === "dynamic_tool_call") return WrenchIcon; | ||
| if (workEntry.itemType === "collab_agent_tool_call") return BotIcon; |
There was a problem hiding this comment.
Move dynamic/collab fallbacks ahead of generic haystack matches
On Line 119, the generic haystack.includes("task") check runs before Lines 125-126. That can still return HammerIcon for dynamic_tool_call / collab_agent_tool_call entries whose text contains “task”, undermining this PR’s icon-fallback fix.
Suggested reorder
if (workEntry.itemType === "web_search") return GlobeIcon;
if (workEntry.itemType === "image_view") return EyeIcon;
if (workEntry.itemType === "mcp_tool_call") return WrenchIcon;
+ if (workEntry.itemType === "dynamic_tool_call") return WrenchIcon;
+ if (workEntry.itemType === "collab_agent_tool_call") return BotIcon;
const haystack = [
workEntry.label,
workEntry.toolTitle,
@@
if (haystack.includes("store_memory")) return FolderIcon;
if (haystack.includes("edit") || haystack.includes("patch")) return WrenchIcon;
if (haystack.includes("file")) return FileIcon;
if (haystack.includes("task")) return HammerIcon;
if (workEntry.activityKind === "turn.plan.updated") return ListTodoIcon;
if (workEntry.activityKind === "task.progress") return HammerIcon;
if (workEntry.activityKind === "approval.requested") return BotIcon;
if (workEntry.activityKind === "approval.resolved") return CheckIcon;
- if (workEntry.itemType === "dynamic_tool_call") return WrenchIcon;
- if (workEntry.itemType === "collab_agent_tool_call") return BotIcon;As per coding guidelines, "apps/web/**: Prioritize UI correctness, responsive layout behavior, and avoiding unnecessary rerenders or fragile client state transitions."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (haystack.includes("task")) return HammerIcon; | |
| if (workEntry.activityKind === "turn.plan.updated") return ListTodoIcon; | |
| if (workEntry.activityKind === "task.progress") return HammerIcon; | |
| if (workEntry.activityKind === "approval.requested") return BotIcon; | |
| if (workEntry.activityKind === "approval.resolved") return CheckIcon; | |
| if (workEntry.itemType === "dynamic_tool_call") return WrenchIcon; | |
| if (workEntry.itemType === "collab_agent_tool_call") return BotIcon; | |
| if (workEntry.itemType === "web_search") return GlobeIcon; | |
| if (workEntry.itemType === "image_view") return EyeIcon; | |
| if (workEntry.itemType === "mcp_tool_call") return WrenchIcon; | |
| if (workEntry.itemType === "dynamic_tool_call") return WrenchIcon; | |
| if (workEntry.itemType === "collab_agent_tool_call") return BotIcon; | |
| const haystack = [ | |
| workEntry.label, | |
| workEntry.toolTitle, | |
| workEntry.activityKind, | |
| ]; | |
| if (haystack.includes("store_memory")) return FolderIcon; | |
| if (haystack.includes("edit") || haystack.includes("patch")) return WrenchIcon; | |
| if (haystack.includes("file")) return FileIcon; | |
| if (haystack.includes("task")) return HammerIcon; | |
| if (workEntry.activityKind === "turn.plan.updated") return ListTodoIcon; | |
| if (workEntry.activityKind === "task.progress") return HammerIcon; | |
| if (workEntry.activityKind === "approval.requested") return BotIcon; | |
| if (workEntry.activityKind === "approval.resolved") return CheckIcon; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/web/src/components/chat/MessagesTimeline.logic.ts` around lines 119 -
126, The generic haystack.includes("task") check is taking precedence and can
incorrectly return HammerIcon for entries that are actually dynamic_tool_call or
collab_agent_tool_call; update MessagesTimeline.logic by moving the
workEntry.itemType checks for "dynamic_tool_call" and "collab_agent_tool_call"
(WrenchIcon and BotIcon) so they run before the haystack.includes("task")
conditional, ensuring those specific itemType fallbacks are matched first; keep
the existing activityKind checks in place and preserve return values for
ListTodoIcon, HammerIcon, BotIcon, and CheckIcon.
This PR fixes a bug where all tool activity icons were displaying as hammers because
dynamic_tool_callandcollab_agent_tool_callitemTypes had a hardcoded hammer fallback.resolveWorkEntryIconinapps/web/src/components/chat/MessagesTimeline.logic.tsdynamic_tool_callfallback fromHammerIcontoWrenchIcon(generic tool icon)collab_agent_tool_callfallback fromHammerIcontoBotIcon(agent/assistant connotation)HammerIconspecifically fortask.progressactivities where it makes semantic senseChatView.tsxandMessagesTimeline.tsxto use the shared resolverMessagesTimeline.logic.test.tsSummary by CodeRabbit
Release Notes
Refactor
Tests