Skip to content

fix(chat): show a shell command's text instead of escaped JSON - #1396

Open
sirenkovladd wants to merge 1 commit into
agegr:mainfrom
sirenkovladd:fix/bash-command-readable
Open

sirenkovladd wants to merge 1 commit into
agegr:mainfrom
sirenkovladd:fix/bash-command-readable

Conversation

@sirenkovladd

@sirenkovladd sirenkovladd commented Oct 23, 2026 •

Copy link
Copy Markdown

Reproduce on main: run any multi-line bash call (e.g. a heredoc script) and expand its card. Finished calls show JSON.stringify output with \n escapes; while the call streams, the card shows the raw rawInput JSON. Newlines never render as line breaks.

Cause: the expanded card only had a dedicated view for write text, codemode scripts and patches; everything else fell back to JSON text, which by spec escapes newlines inside strings.

Change:

  • bash/powershell calls (new isBashToolName, matching lib/tool-names.ts conventions) with exactly { command, timeout? } now show the command text with real line breaks, finished and while streaming. Streaming input decodes the command string up to the last chunk (mid-escape cuts included); unparseable input, empty commands and calls with extra arguments keep the old view, so nothing is hidden.
  • The header previews the command's first line plus (timeout Ns), as pi's TUI shows $ followed by the command and a timeout suffix; while streaming it shows the partial command instead of "Generating parameters" once it parses.
  • Mirrored in demo/; topic note updated in docs/agents/sessions.md.

Checks: MessageView 51/51 (3 new tests), tsc --noEmit clean, eslint clean (main + demo configs). Full npm test: 2870/2873 — the 2 failures (rpc-manager-chat-only model naming, worktree listing) reproduce on clean main and are unrelated.


Before
image

After
image

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant