refactor(workspaces): tighten tool call row and enrich summaries - #684
Conversation
- Drop the redundant static registry title from the tool activity row so the summary carries the full label without repeating the verb. - Hide `workspace_list_items` from the chat UI and delete its receipt code — listings are an internal operation, not a user-facing action. - Rewrite fallback summaries so unregistered tools still read as standalone sentences (e.g. "Running foo", "Ran foo", "Foo failed"). - Surface more per-tool detail: PDF page ranges on reads, new name on renames, destination on moves, warning counts on edits, and URL paths on `web_markdown`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
React Doctor found 1 new issue in 1 file · 1 warning · score 92 / 100 (Great) · 0 fixed · vs 1 warning
Reviewed by React Doctor for commit |
| } | ||
| case "workspace_read_items": { | ||
| const requests = getArray(toolInput.requests).map((request) => asRecord(request)); | ||
| const paths = requests.map((request) => getString(request.path)).filter(Boolean) as string[]; |
There was a problem hiding this comment.
React Doctor · react-doctor/js-flatmap-filter (warning)
This loops over your list twice because .map().filter(Boolean) makes two passes, so use .flatMap() to change & drop items in one pass
Fix → Use .flatMap(item => condition ? [value] : []) to change and drop items in one pass, instead of building a throwaway array in between
📝 WalkthroughWalkthroughAI tool receipts now provide more specific summaries for workspace, web, research, and Code Mode operations. Activity rows display the activity summary directly, workspace list-items is hidden in the UI, and display-state tests use web-search fixtures. ChangesAI tool activity presentation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
🧹 Nitpick comments (1)
src/features/workspaces/components/ai-chat/ai-chat-display-state.test.ts (1)
19-47: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRetain explicit coverage for hidden
workspace_list_items.These replacements now exercise visible
web_search, but no longer prove that a hiddenworkspace_list_itemscall is omitted or that fallback to a visible sibling works. Keep a fixture containing both tools and assert that only the visible child is rendered.Also applies to: 57-77
🤖 Prompt for 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. In `@src/features/workspaces/components/ai-chat/ai-chat-display-state.test.ts` around lines 19 - 47, Update the test fixture and assertions around getDisplayableParts and AiChatToolGroupPart to include both a hidden workspace_list_items tool and a visible sibling tool. Assert that the rendered group contains only the visible child, preserving explicit coverage that workspace_list_items is omitted and visible sibling fallback remains supported.
🤖 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.
Nitpick comments:
In `@src/features/workspaces/components/ai-chat/ai-chat-display-state.test.ts`:
- Around line 19-47: Update the test fixture and assertions around
getDisplayableParts and AiChatToolGroupPart to include both a hidden
workspace_list_items tool and a visible sibling tool. Assert that the rendered
group contains only the visible child, preserving explicit coverage that
workspace_list_items is omitted and visible sibling fallback remains supported.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a1f27e69-c875-4412-8311-be7f09b74dd6
📒 Files selected for processing (4)
src/features/workspaces/ai/ai-tool-registry.tssrc/features/workspaces/components/ai-chat/AiChatToolActivityRow.tsxsrc/features/workspaces/components/ai-chat/ai-chat-display-state.test.tssrc/features/workspaces/components/ai-chat/ai-chat-tool-receipts.ts
Greptile SummaryRefines AI tool activity rows and receipt summaries.
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code failures identified. The hidden-tool paths remain filtered by the existing display-state logic, and the enriched summaries consume fields guaranteed by the corresponding workspace operation schemas and producers. Files Needing Attention: No files require additional attention.
What T-Rex did
|
| Filename | Overview |
|---|---|
| src/features/workspaces/ai/ai-tool-registry.ts | Marks workspace listing activity as hidden while preserving its tool registration and behavior. |
| src/features/workspaces/components/ai-chat/AiChatToolActivityRow.tsx | Removes the redundant registry title and renders the activity summary as the row’s primary truncated label. |
| src/features/workspaces/components/ai-chat/ai-chat-display-state.test.ts | Replaces newly hidden workspace-list fixtures with visible web-search fixtures while retaining display grouping coverage. |
| src/features/workspaces/components/ai-chat/ai-chat-tool-receipts.ts | Enriches tool receipts using fields consistent with workspace operation contracts and introduces standalone fallback summaries. |
Reviews (1): Last reviewed commit: "refactor(workspaces): tighten tool call ..." | Re-trigger Greptile
|
Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
Summary
Read workspace·Read 3 items).workspace_list_itemsfrom the chat UI entirely — listings are an internal operation, not something a user needs to see."Working","Done","Couldn't complete") so that unregistered tools still read as standalone sentences without a title next to them.web_markdown.Before / after
workspace_read_items(PDF)Read workspace·Read "paper.pdf"Read "paper.pdf" p. 1–3workspace_read_items(partial PDF)Read workspace·Read "paper.pdf"Read "paper.pdf" p. 1–3 of 42workspace_rename_itemRename item·Renamed "old"Renamed "old" → "new"workspace_move_itemsMove items·Moved 2 itemsMoved 2 items to "Archive"workspace_edit_itemEdit item·Updated "notes.md" with 3 editsUpdated "notes.md" with 3 edits, 1 warningweb_markdownRead webpage·Read acme.comRead acme.com/blog/postworkspace_list_itemsList workspace·Listed 5 itemsTool·DoneRan my_toolTest plan
npm run check(biome + tsc) passesnpm run test(all 136 tests) passes🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit