fix(desktop): show full command in approval prompt - #44977
Closed
annguyenNous wants to merge 1 commit into
Closed
Conversation
The inline approval bar only displayed action buttons (Run/Reject) without showing the command being approved. The tool row header above truncated long commands to 120 chars via compactPreview(), leaving users unable to review what they were about to approve. Add a collapsible <pre> block in the approval bar that shows the full command text. Short commands (<=120 chars) are shown in full; long commands are collapsed to ~3 lines with a click-to-expand affordance. The block uses whitespace-pre-wrap and break-all so multi-line and long single-line commands are fully visible. Fixes NousResearch#44888
Collaborator
|
Good |
1 task
Contributor
|
Thanks for the focused desktop safety improvement. This is already implemented on current
This PR is therefore redundant with the shipped behavior. |
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.
Fixes #44888
Problem
The inline approval bar only showed action buttons (Run / Reject / Always allow) without showing the command being approved. The tool row header above truncated long shell commands to 120 characters via
compactPreview(), leaving users unable to review what they were about to approve or reject.Root Cause
In
tool-approval.tsx, theApprovalBarcomponent rendered a flat<div>with buttons only. The comment at line 25-27 explicitly said "the row already shows the command, so the strip deliberately doesn't repeat it" — but the row'scompactPreview(command, 120)truncates long commands with..., making it impossible to see the full command.Fix
Add a collapsible
<pre>block in the inline approval bar that shows the full command text:max-h-12) with a click-to-expand affordancewhitespace-pre-wrapandbreak-allso multi-line and long single-line commands wrap properly<pre>blockChanges
apps/desktop/src/components/assistant-ui/tool-approval.tsx: Added command preview<pre>block,cnimport,commandExpandedstateTesting
approvals.mode: manual)export FOO=bar && podman run --rm -v /long/path:/app -e ENV=value python:3.12 python -c 'print("hello")')