fix(cli): show tool details in subagent approval banner - #3956
Merged
Conversation
Collaborator
Author
E2E Test Summary
Captured frame after fix (scenario 3 — multi-line heredoc) |
The compactMode early-return in ToolConfirmationMessage hid the per-type body and question, so the inline subagent banner showed only "Approval requested by <agent>: / Do you want to proceed?" with three options and no indication of which command, file, or MCP tool was being approved. Move the compact-mode handling to the unified return path so per-type body and question render in compact form too. Compact mode also: - Swaps the type-specific exec/mcp question for the generic prompt (the body already shows the command or labeled server + tool, and the exec rootCommand summary surfaces a pre-existing core parser oddity for heredocs that we'd rather not echo into every banner). - Caps the body at 5 lines with MaxSizedBox so a long heredoc can't push other content off-screen; the overflow indicator tells the user content was elided. - Sets MaxSizedBox overflowDirection="bottom" on exec so the head of the command (the action verb + redirection target) stays visible while the tail elides.
tanzhenxin
force-pushed
the
fix-subagent-approval-tool-details
branch
from
May 8, 2026 09:57
28b3081 to
666d7f7
Compare
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
TaimoorSiddiquiOfficial
pushed a commit
to TaimoorSiddiquiOfficial/HopCode
that referenced
this pull request
May 8, 2026
The compactMode early-return in ToolConfirmationMessage hid the per-type body and question, so the inline subagent banner showed only "Approval requested by <agent>: / Do you want to proceed?" with three options and no indication of which command, file, or MCP tool was being approved. Move the compact-mode handling to the unified return path so per-type body and question render in compact form too. Compact mode also: - Swaps the type-specific exec/mcp question for the generic prompt (the body already shows the command or labeled server + tool, and the exec rootCommand summary surfaces a pre-existing core parser oddity for heredocs that we'd rather not echo into every banner). - Caps the body at 5 lines with MaxSizedBox so a long heredoc can't push other content off-screen; the overflow indicator tells the user content was elided. - Sets MaxSizedBox overflowDirection="bottom" on exec so the head of the command (the action verb + redirection target) stays visible while the tail elides.
B-A-M-N
pushed a commit
to B-A-M-N/qwen-code
that referenced
this pull request
May 8, 2026
The compactMode early-return in ToolConfirmationMessage hid the per-type body and question, so the inline subagent banner showed only "Approval requested by <agent>: / Do you want to proceed?" with three options and no indication of which command, file, or MCP tool was being approved. Move the compact-mode handling to the unified return path so per-type body and question render in compact form too. Compact mode also: - Swaps the type-specific exec/mcp question for the generic prompt (the body already shows the command or labeled server + tool, and the exec rootCommand summary surfaces a pre-existing core parser oddity for heredocs that we'd rather not echo into every banner). - Caps the body at 5 lines with MaxSizedBox so a long heredoc can't push other content off-screen; the overflow indicator tells the user content was elided. - Sets MaxSizedBox overflowDirection="bottom" on exec so the head of the command (the action verb + redirection target) stays visible while the tail elides.
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.
Summary
general-purpose) requested permission to run a tool, the inline approval banner showed only the agent name, a genericDo you want to proceed?, and three options — the actual command / file diff / MCP tool was hidden, so the parent had no idea what to approve.ToolConfirmationMessage'scompactModeearly-return rendered before the per-type body and question were built. Moved compact-mode handling to the unified return path so the same body renders in compact form. While there:MaxSizedBoxoverflow indicator so a long heredoc can't push other content off-screen.overflowDirection="bottom"on exec so the head of the command (action verb + redirection target) stays visible while the tail elides.ToolConfirmationMessage.tsx— the unified return path (per-type body + generic question + trimmed 3-option list), theavailableBodyContentHeight()constants now being compactMode-aware, and theCOMPACT_BODY_MAX_LINES = 5cap applied to exec/plan body height.Validation
/tmpdir under--approval-mode default):Do you want to proceed?, and the trimmed 3-option list. For multi-line commands, the head is preserved and the tail elides behind a... last N lines hidden ...indicator.npm run build && npm run bundle, thencd /tmp && node <repo>/dist/cli.js --approval-mode defaultand run the prompt above; the banner should displayrm -f …andDo you want to proceed?.Before / After
Before:
After (single-line command):
After (multi-line heredoc — body capped, head preserved):
Scope / Risk
edit/info/plan/mcpconfirmation types — they all flow through the same unified return path with identical compact props, and unit tests now coverexecandmcpbody content + trimmed options + the 5-line body cap with overflow indicator.Testing Matrix
Testing matrix notes:
npm run build && npm run bundle && node dist/cli.js. The fix is a pure render change in an Ink TUI component — platform-dependent behavior is not expected.Linked Issues / Bugs
Fixes #3960