Make the shell approval dialog readable - #290
Merged
TheGreatAxios merged 5 commits intoAug 4, 2026
Conversation
TheGreatAxios
force-pushed
the
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command
branch
from
August 1, 2026 17:54
6291bbf to
5a24409
Compare
TheGreatAxios
force-pushed
the
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command
branch
from
August 2, 2026 04:09
5a24409 to
5b7daca
Compare
TheGreatAxios
force-pushed
the
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command
branch
2 times, most recently
from
August 2, 2026 04:49
363093a to
981156c
Compare
TheGreatAxios
force-pushed
the
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command
branch
from
August 4, 2026 00:12
981156c to
ef740f5
Compare
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
force-pushed
the
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-command
branch
from
August 4, 2026 00:27
ef740f5 to
fcc7f32
Compare
TheGreatAxios
marked this pull request as ready for review
August 4, 2026 03:17
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
Verification
bun run typecheck && bun run build && bun test— full suite passes (3581/3581)Closes CL-4868