fix(ui): make Write tool expandable and show overwrite indicator#9056
Open
Githubguy132010 wants to merge 6 commits intoKilo-Org:mainfrom
Open
fix(ui): make Write tool expandable and show overwrite indicator#9056Githubguy132010 wants to merge 6 commits intoKilo-Org:mainfrom
Githubguy132010 wants to merge 6 commits intoKilo-Org:mainfrom
Conversation
…te tool The Write tool card in the chat had no at-a-glance signal of what it did — no "Created" vs overwrite indicator, and no additions/deletions count like the sibling Edit tool shows. Without those cues the `ToolFileAccordion` expand affordance read as a flat non-interactive card, even though the file contents were already available. Adds a "Created" badge when `metadata.exists === false`, and +/- change counts from `metadata.filediff` otherwise, both in the trigger header and as actions on the accordion header — matching the patterns used by the Edit and apply_patch renderers. Also drops the `input.content` guard on the accordion so empty writes still render their header. Closes Kilo-Org#9053 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by gpt-5.4-20260305 · 641,340 tokens |
The outer BasicTool trigger in packages/ui was gating on metadata.exists, so newly created files rendered a plain filename/path header with no change indicator — defeating the whole point of the fix, since users can't tell the card is expandable in the first place. Mirror the inner accordion's Switch in the outer trigger: Created badge when exists === false, +/- counts otherwise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Closes #9053.
The reporter said the Write tool card in the chat "is not expandable at all, so you can't see what the agent did / wrote," and asked for an indicator of whether the write was an overwrite or a new file.
Tracing it, the content is already wrapped in a
ToolFileAccordion, but the trigger carried no at-a-glance signal — no "Created" badge, no+N -Mchange count like the sibling Edit tool — so users read the card as flat / non-interactive and never tried to expand it.Backend already emits
exists: booleanandfilediff.{additions,deletions}in the Write tool metadata (packages/opencode/src/tool/write.ts), so no backend changes needed.Implementation
Brings the Write tool's trigger to parity with Edit / apply_patch:
packages/kilo-ui/src/components/message-part.tsx(used by the VS Code sidebar):ToolMetaLinein the trigger now receiveschanges={props.metadata.filediff}— so the header shows+N -Mat rest. TheToolFileAccordiongets anactionsprop that shows a "Created" badge (data-slot="apply-patch-change" data-type="added", reusing theui.patch.action.createdi18n key) whenmetadata.exists === false, or<ToolChanges>otherwise.packages/ui/src/components/message-part.tsx(upstream@opencode-ai/ui): same logic, using the simplerDiffChanges-only pattern this file already uses for Edit/apply_patch. Wrapped in// kilocode_change start/endper repo convention.pathis known (previously gated oninput.content && path), so the header + badge show even for an empty write; the inner content body still guards oninput.content != null.ui.patch.action.createdi18n key — no new translation strings.Screenshots
How to Test
Createdbadge next to the filename.+N -Madditions/deletions counts instead of the badge.@opencode-ai/uistorybook — same behavior via the sharedpackages/uirenderer.Get in Touch
🤖 Generated with Claude Code