Skip to content

fix(desktop): show full command in approval prompt - #44977

Closed
annguyenNous wants to merge 1 commit into
NousResearch:mainfrom
annguyenNous:fix/desktop-approval-command-truncation
Closed

fix(desktop): show full command in approval prompt#44977
annguyenNous wants to merge 1 commit into
NousResearch:mainfrom
annguyenNous:fix/desktop-approval-command-truncation

Conversation

@annguyenNous

Copy link
Copy Markdown
Contributor

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, the ApprovalBar component 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's compactPreview(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:

  • Short commands (<=120 chars, single line): shown in full, no interaction needed
  • Long commands: collapsed to ~3 lines (max-h-12) with a click-to-expand affordance
  • Uses whitespace-pre-wrap and break-all so multi-line and long single-line commands wrap properly
  • Styled consistently with the existing "Always allow" dialog's command <pre> block

Changes

  • apps/desktop/src/components/assistant-ui/tool-approval.tsx: Added command preview <pre> block, cn import, commandExpanded state

Testing

  1. Enable manual approval mode (approvals.mode: manual)
  2. Ask the agent to run a long shell command (e.g., export FOO=bar && podman run --rm -v /long/path:/app -e ENV=value python:3.12 python -c 'print("hello")')
  3. Verify the full command is visible in the approval prompt
  4. Short commands should display without truncation
  5. Click on a collapsed long command to expand it

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
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) duplicate This issue or pull request already exists labels Jun 12, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #44864 (earliest open PR for #44888). #44864, #44910, and this PR all add a full-command preview to the desktop inline approval bar in tool-approval.tsx. Marking duplicate; maintainers can pick the canonical implementation.

@cdlixuefeng-droid

Copy link
Copy Markdown

Good

@alt-glitch alt-glitch added comp/desktop Electron desktop app (apps/desktop/*) and removed comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 26, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused desktop safety improvement. This is already implemented on current main; this is an automated hermes-sweeper review.

  • The duplicate comment correctly identified feat(desktop): expand the full command inline from the approval bar #44864 as the canonical implementation; it merged as 5d6c16e97237ca08778291a11695faff9b2e5963.
  • Commit 266b5a19f128799d2c604a965872608902836ceb added the approval-bar Command toggle.
  • apps/desktop/src/components/assistant-ui/tool/approval.tsx:231-248 renders the full pending command in a wrapped, scrollable <pre> before approval.
  • apps/desktop/src/components/assistant-ui/tool/approval.test.tsx:87-98 covers revealing a 400-character command in full.
  • The implementation shipped in v2026.6.19.

This PR is therefore redundant with the shipped behavior.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop: Long shell commands are truncated in the approval prompt with no way to view the full command

4 participants