Repository navigation
fix(ai): unwrap execute_tool in chat renderers - #1314
Conversation
- Unwrap execute_tool calls to show the underlying tool name and rich content instead of the dispatcher wrapper - Hide tool_search entirely — schema discovery is an impl detail - Works for both ToolCallRenderer and CompactToolCallRenderer - Special-case routing (update_task, ask_agent) still applies after unwrap
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughBoth ChangesTool-call unwrapping and routing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/web/src/components/ai/shared/chat/tool-calls/CompactToolCallRenderer.tsx`:
- Around line 829-841: The top-level filter skips only a first-level
'tool_search' but misses when execute_tool unwraps into an inner 'tool_search';
update the execute_tool branch in CompactToolCallRenderer (where safeJsonParse
is used and innerName/resolvedPart are set) to check if innerName ===
'tool_search' and return null in that case before continuing, ensuring you still
handle the update_task case and ultimately call CompactToolCallRendererInternal
only when the unwrapped toolName is not 'tool_search'.
In `@apps/web/src/components/ai/shared/chat/tool-calls/ToolCallRenderer.tsx`:
- Around line 821-834: The current logic only hides direct "tool_search" calls
before unwrapping; after the execute_tool block (where toolName may be
reassigned by parsing part.input via safeJsonParse), add a second guard that
returns null when the unwrapped toolName equals 'tool_search'. Concretely: after
the execute_tool handling that sets toolName and resolvedPart, check if toolName
=== 'tool_search' and return null so nested schema-discovery calls are also
suppressed; keep the rest (update_task, ask_agent, ToolCallRendererInternal)
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6c8c2bb4-5a96-4bc0-b30e-0a273b3193af
📒 Files selected for processing (2)
apps/web/src/components/ai/shared/chat/tool-calls/CompactToolCallRenderer.tsxapps/web/src/components/ai/shared/chat/tool-calls/ToolCallRenderer.tsx
Add a second tool_search guard after the execute_tool unwrap block so that execute_tool dispatching to tool_search is also hidden, not just top-level tool_search calls.
|
Addressed both CodeRabbit findings in commit a772900:
Both renderers now suppress |
* fix(ai): unwrap execute_tool in chat renderers - Unwrap execute_tool calls to show the underlying tool name and rich content instead of the dispatcher wrapper - Hide tool_search entirely — schema discovery is an impl detail - Works for both ToolCallRenderer and CompactToolCallRenderer - Special-case routing (update_task, ask_agent) still applies after unwrap * fix(ai): suppress tool_search after execute_tool unwrap Add a second tool_search guard after the execute_tool unwrap block so that execute_tool dispatching to tool_search is also hidden, not just top-level tool_search calls.
Summary
execute_tooldispatcher calls are now transparently unwrapped in bothToolCallRendererandCompactToolCallRenderer— the UI shows the actual underlying tool (e.g. "Create Page", "Web Search") instead of "Execute Tool"tool_searchcalls are hidden entirely — schema discovery is an implementation detail users don't need to seeupdate_task→TaskRenderer,ask_agent→PageAgentConversationRenderer) still applies correctly after unwrapTest plan
tool_search— nothing should render in the UI for itupdate_taskviaexecute_tool—TaskRenderershould still firelist_pages) — existing rendering unchanged🤖 Generated with Claude Code
Summary by CodeRabbit