Repository navigation
fix(cli): abbreviate run_command titles in Step tool rows - #275
Merged
Merged
Conversation
The Step presentation reused the native bash call renderer, whose multi-line `$ <command> (timeout ...)` echo was moved into the result body. Long inline scripts and heredocs therefore filled the transcript with the full command. Preview the command in the run_command title (line breaks folded, first 50 characters plus an ellipsis) and drop the echo rows while collapsed. The full command is still shown in the body on expand when the title shortened it.
ZouR-Ma
requested review from
MelodyVAR,
Uking-xxx and
liuedcson
as code owners
October 20, 2026 11:06
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.
Problem
In the Step presentation, a
run_commandcall with a long or multi-line command (inlinenode -e/playwriter -escripts, heredocs) prints the entire command in the transcript, often dozens of rows before any output. This pushes the actual result off screen.Root cause:
run_commandreuses the native bashrenderCall, which renders$ <command> (timeout Ns)as a multi-lineText.ToolExecutionComponent.buildStepDefaultLinesreplaces the first row with therun_command(...)title but moves the remaining rows into the result body under the└connector, as it does forwrite's preview rows. The title itself was also not shortened, only clipped to the terminal width.Changes
apps/cli/src/ui/view/transcript/tool-execution.ts:run_command(...)title now shows a command preview: line breaks and their surrounding indentation fold into one space, and the text is cut to the first 50 code points with a trailing….run_command, the native call-renderer rows are no longer moved into the body while collapsed. The body shows only command output and the existing expand hint.$ <command> (timeout …)rows are placed above the output, but only when the title preview differs from the raw command (it was shortened or reflowed). They are rendered at body width so the connector does not clip them. Short single-line commands do not get a duplicate echo row.write_filepreview).Behavior and compatibility
presentation: "step"). The native Pi presentation, tool arguments, execution, persisted transcripts, and model-visible output are unchanged.app.tools.expand, Ctrl+O by default).(timeout Ns)suffix is no longer shown for multi-line or long commands. Single-line commands already did not show it in the Step title. The suffix remains visible on expand.Validation
pnpm exec vitest --run test/step-tool-row-contract.test.ts test/tool-execution-component.test.ts(fromapps/cli): 2 files, 48 tests passed. Adds regression tests covering:…, the command tail and timeout are absent, and the first body row is the output. On expand, the full command and output are visible.pnpm test): the title is verbatim and there is no$ pnpm testecho row on expand.pnpm exec vitest --run test/tui-acceptance-snapshot.test.ts test/tui-acceptance-interactions.test.ts(fromapps/cli): 2 files, 42 tests passed. No snapshot updates.pnpm run check: exit 0../test.shon this branch (based onorigin/main): all workspaces passed. For example,coding-agentpassed 4860 tests with 59 skipped, andapps/clipassed 735 tests. Local notes:TMPDIR=/tmpbecause the default macOSTMPDIRmadesubagent-invocation.test.tsfail withlisten EINVAL: tsx's IPC socket path exceeded the Unix socket length limit. This is an environment issue unrelated to this change.Platform: macOS (darwin), Node.js 24.3.0.
Limitations
None. CI (
Check commit attribution,build-check-test) passed.Manual check in a live terminal (
./step-test.shin tmux, 160x45, real model):node -e "..."command: the collapsed row reads● run_command(node -e " const marker = 'FULL_COMMAND_TAIL'; for …)followed directly by output. Ctrl+O shows the full$ node -e "..." (timeout 120s)above the output.echo short-ok(with tool output expanded):● run_command(echo short-ok),└ short-ok, and no duplicate$ echo short-okrow.