Repository navigation
fix(studio): show the whole approval command and its invisible characters - #2329
Merged
Merged
Conversation
Pin what #2259 must not change before it changes the command view: an ordinary command, its raw arguments, and a JSON view keep exactly their text and the card's controls; the card keeps each view in its compact scroll box; the Edit diff keeps its box; and the detail panel shows a long command whole, with no cap and no toggle. Refs #2259 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ters The approval card's command view showed a long command's first lines in a fixed-height scroll box, with nothing saying more followed. It also passed bidirectional controls and zero-width characters through unchanged, so the text a reviewer read could differ from the text that runs. - A command longer than 12 lines shows its first 12, its line count, and a "Show N more lines" toggle that expands the whole command. A command whose wrapped lines overflow the box gets "Show full command". The detail panel still shows the whole command. - The command, raw, and JSON views show U+202A-U+202E, U+2066-U+2069, U+200B-U+200D, and U+FEFF as badges such as ⟨U+202E⟩, named "invisible character U+202E" for assistive technology. The badge keeps the character as its text and draws the label with CSS, so copying yields the exact original text, and its box stops a bidirectional control from reordering the text around it. - A "Contains invisible characters" chip appears beside Raw arguments when the arguments carry any, as sent or JSON-escaped. The verdict buttons, shortcuts, diff view, and approval decision are unchanged. Closes #2259 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Extend the approval card's invisible-character set beyond the issue's code points: - the implicit bidi marks U+200E, U+200F, and U+061C; - the word joiner U+2060 and the invisible operators U+2061-U+2064; - the tag characters U+E0000-U+E007F. Each is one code point stored as a surrogate pair, which the pattern's u flag matches as one, so it renders as one badge and copies as sent. The variation selectors U+FE00-U+FE0F stay out, so emoji keep their look. The detection boundary test no longer lists U+200E, which joined the set; it gains U+061B, U+061D, U+2010, U+205F, U+FE00, U+FE0F, U+DFFFF, and U+E0080. The browser journey adds a tag character. Refs #2259 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 14, 2026
Member
|
Not a blocker for this PR, but looking at the screenshots, it would be nice to have syntax highlighting for bash commands, or integrating a bash explainer (I think there are open source packages for that) In any case if you agree this would be more like a follow up question for James than anything |
kantord
approved these changes
Oct 14, 2026
Merged
2 tasks
This branch was successfully deployed
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.
Part of a 4-PR stack: #2329 → #2330 → #2331 → #2332. Review in any order; merge bottom-up.
Summary
A reviewer approving a shell command can now always see all of it, and sees exactly the characters that will run.
On the approval card, a command longer than the compact box shows its line count and a Show N more lines toggle that expands the whole command. Invisible formatting characters render as named badges such as ⟨U+202E⟩ in the command, raw, and JSON views, and a Contains invisible characters chip appears on the card when the arguments carry any. The set covers the bidirectional controls and marks (U+061C, U+200E, U+200F, U+202A to U+202E, U+2066 to U+2069), the zero-width characters (U+200B to U+200D, U+FEFF), the word joiner and invisible operators (U+2060 to U+2064), and the tag characters (U+E0000 to U+E007F). Copying still yields the exact original text. The verdict buttons, shortcuts, diff view, layout of the rest of the card, and the approval decision are unchanged.
What changed
Long commands (
apps/web/src/features/chat/ask-args-view.tsx)useIsTruncatedhook, only while the command is collapsed.border-t border-border/60row and the same ghostButton(h-6 px-2 text-xs, muted), witharia-expandedandaria-controlspointing at the command.Invisible characters (
apps/web/src/features/chat/invisible-characters.tsx, new)VisibleTextrenders each listed character as the design system'sBadge(warning variant, existing tokens) withrole="img"and the accessible name "invisible character U+202E". Text without one renders exactly as before, as a single text node.before:content-[attr(data-label)]). Selecting and copying read the DOM text, so the clipboard gets the exact original characters, never the label.argsHaveInvisibleCharacters, which checks the arguments as sent and as their JSON decodes, since the command and JSON views show decoded text (a JSON escape such as\u202eshows as a badge there and as the escape text in the raw view).uflag matches it as one, so it renders as one badge, named for the full code point (⟨U+E0041⟩), and copies as sent.Docs
user-docs/operating/studio.mdgains two sentences in "Review tool calls and plans": which characters show as badges, and that copied text keeps them.Difference from the prototype
The prototype has no such handling. Its
ask-args-view.tsxshows the command in the same fixed-height scroll box with no line count, and passes these characters through unchanged in every view. Both changes are deliberate additions beyond the prototype. Everything else on the card stays as the existing port has it.Not in this PR
The transcript's tool-call summary line above the card and the Edit and Write diff view still show these characters as sent. Both are follow-ups. Meanwhile, the chip appears whenever an ask's arguments carry one, and Raw arguments shows them as badges.
No regression
Pins first.
test(studio): pin the approval card's argument views(ask-args-view.pinning.test.tsx, 8 tests) landed before the change and passes on the base and on this branch:No existing test was modified or deleted. Existing coverage of the diff limits ("more diff lines" on the card, Show all 61 lines in the detail panel), verdict order and tab stops, shortcuts, tone, and the plan card is unchanged and passes.
New tests.
ask-args-view.test.tsx(61 tests):aria-expanded,aria-controls), expands to the whole command with no scroll cap, and collapses again; 13 lines reads Show 1 more line; the timeout row stays outside the scroll box; a wrapped single line that overflows offers Show full command;apps/web/e2e/approval-command-view.spec.ts(3 journeys, desktop and phone) checks in Chromium what Happy DOM can't: the count and toggle sit in view outside the command's scroll box; a long wrapped line offers Show full command; each badge is visible with its CSS label, including a tag character's; the words after a U+202E stay in reading order; and the clipboard gets the exact command and raw arguments, surrogate pair included. The screenshot runs measured the same order: on the base, "notes" indocs/<U+202E>notes.txtsits to the right of "txt" (488 px vs 460 px on desktop), and on this branch to its left (595 px vs 638 px).Mutation proof. Each mutation was applied to the head and reverted. The unit runs cover the 61 new tests and the 8 pins:
ask-args-view.tsxreverted to the baseScreenshots
Each frame is Before (base
42b933fb4) | After (this branch) | Prototype (stack-08). The prototype column is its own fixture chat, with the pending ask's arguments replaced by the same command. Red boxes mark before/after differences of 40 px or more. Each tree was captured twice, and the runs match apart from 32 px of anti-aliasing at the left page edge of one phone frame. The frames use only the issue's characters, so the follow-up commit that extends the set leaves them unchanged.Long command, desktop light. After shows the first 12 lines, "60 lines", and Show 48 more lines, with the timeout row in view. Deliberate deviation: the prototype shows the same scroll box as Before, with no line count.
Invisible characters, desktop light. After shows each character as a badge and the Contains invisible characters chip, and "notes.txt" reads in order after the U+202E badge. Deliberate deviation: the prototype, like Before, renders the characters as sent, so the override reverses "notes.txt".
Long command: phone and dark
Invisible characters: phone and dark
The card alone: collapsed, expanded, and raw arguments
Long command, collapsed:
Long command, after Show 48 more lines (Before and Prototype have no toggle, so they show their only state):
Invisible characters, command view:
Invisible characters, Raw arguments:
Gates
All gates ran through the shared gate lock, on this branch's head
ca850bc9a, which is unchanged by the stack assembly (it sits directly onmain).42b933fb4)ca850bc9a)task studio:checktask studio:browsertask docsThe 30 skipped journeys are the phone-only checks on the desktop project, as on the base. The +69 web tests are the 8 pins and the 61 new tests; the 6 new browser tests are the 3 journeys in both projects.
Closes #2259
Part of #2210
🤖 Generated with Claude Code