Skip to content

Make the shell approval dialog readable - #290

Merged
TheGreatAxios merged 5 commits into
cl-4865-approval-prompts-must-clearly-identify-which-sub-agent-isfrom
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command
Aug 4, 2026
Merged

Make the shell approval dialog readable#290
TheGreatAxios merged 5 commits into
cl-4865-approval-prompts-must-clearly-identify-which-sub-agent-isfrom
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The command renders exactly once, as the segment list — the separate raw verbatim dump that duplicated it is gone
  • Heredoc bodies and multi-line quoted arguments (commit messages, etc.) collapse to a "<label, N lines>" placeholder inline, expandable via the existing Ctrl+O
  • Persistent Allow options lead with a single concise grant subject and its scope ("Allow these 4 git commands — this session") instead of a duplicated, ellipsized command mash with the scope buried and dimmed at the end
  • The dialog fits typical terminal height for a compound command without mid-word truncation

Verification

  • bun run typecheck && bun run build && bun test — full suite passes (3581/3581)
  • New coverage: src/tui/command-display.test.ts (collapseSegmentPayloads) and tests/unit/tui/permission-modal.test.tsx (heredoc/quoted-payload collapsing, Ctrl+O expansion, scope-led Allow labels), plus updated pre-existing assertions that encoded the old duplicated-dump behavior

Closes CL-4868

@linear-code

linear-code Bot commented Aug 1, 2026

Copy link
Copy Markdown

CL-4868

@TheGreatAxios
TheGreatAxios force-pushed the cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command branch from 6291bbf to 5a24409 Compare August 1, 2026 17:54
@TheGreatAxios
TheGreatAxios force-pushed the cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command branch from 5a24409 to 5b7daca Compare August 2, 2026 04:09
@TheGreatAxios
TheGreatAxios force-pushed the cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command branch 2 times, most recently from 363093a to 981156c Compare August 2, 2026 04:49
@TheGreatAxios
TheGreatAxios force-pushed the cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command branch from 981156c to ef740f5 Compare August 4, 2026 00:12
The command now renders exactly once, as the segment list — the separate
raw verbatim dump that duplicated it is gone. Heredoc bodies and
multi-line quoted arguments (commit messages, etc.) collapse to a
"<label, N lines>" placeholder inline, expandable via the existing
Ctrl+O. Persistent Allow options now lead with a single concise grant
subject and its scope ("Allow these 4 git commands — this session")
instead of a duplicated, ellipsized command mash with the scope buried
and dimmed at the end.
collapseSegmentPayloads hid quoted or heredoc payloads by quote
syntax alone, so eval "\$(cat <<'EOF' ... EOF)" and similar
substitutions into eval/source/xargs/env/shell -c rendered as a
placeholder instead of the code the operator is being asked to
approve. Those payloads now always render in full; plain data sinks
like git commit -m still collapse as before.
Path-qualified interpreters (/bin/bash -c, ./sh -c) were not recognized
because the guard compared bare tokens literally; match by basename
instead. Extend the interpreter table beyond bash/sh/zsh/dash with
python/python3 (-c), node (-e/--eval), ruby (-e), perl (-e), and php
(-r), each keyed to its own code flag rather than one shared -c. Treat
ssh as unconditionally code-consuming, since a payload after the host
always executes remotely regardless of flags.

Wrapper prefixes (env, sudo, nohup, timeout, xargs -I) already evade
detection for free, since the guard scans every word in the segment
rather than just the first — sudo/env/timeout/nohup wrapping bash -c
already trips the bash+-c co-occurrence check. find -exec and the
command builtin are left unhandled: neither routes through a
recognized interpreter word, and unwrapping them cleanly needs
positional parsing this pass does not add.
segmentWords split on raw whitespace with no quote-awareness, so a
trigger word inside a quoted payload — a commit message mentioning
'source', a heredoc line mentioning 'env' — falsely marked the segment
as code-consuming and suppressed collapsing it. Rewrite segmentWords to
walk the segment and skip quoted and heredoc-body spans, so only the
actual command and its flags are considered.
Cover bare interpreters, heredocs without -c, -s, pipes into bash/sh, and
quoted -c flags so executable bodies never hide behind a placeholder.
@TheGreatAxios
TheGreatAxios force-pushed the cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command branch from ef740f5 to fcc7f32 Compare August 4, 2026 00:27
@TheGreatAxios
TheGreatAxios marked this pull request as ready for review August 4, 2026 03:17
@TheGreatAxios
TheGreatAxios merged commit c055291 into main Aug 4, 2026
1 check passed
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