Skip to content

[Bug]: Agent Dashboard terminal preview swallows the close shortcut #13958

Closed

Description

@pstanton237

Operating system

macOS

Orca version

v1.4.180

Details

Short summary:

The Agent Dashboard terminal preview does not close when the configured pane-close shortcut is pressed. On macOS, Command+W is consumed with no visible result.

What happened?

The preview routes terminal keys through the regular pane shortcut policy. That policy resolves Command+W to closeActivePane, but the preview key handler treats every pane-scoped action as having no target and only consumes the event. The dialog remains open.

How can we reproduce it?

  1. Open the Agent Dashboard pop-out window.
  2. Open an agent card with a live terminal preview.
  3. Press Command+W while the preview terminal has focus.
  4. Observe that the key is consumed and the preview remains open.

Expected behavior:

The configured pane-close shortcut should close only the terminal preview. The Agent Dashboard window, agent process, and PTY session should remain open. Plain Escape should continue reaching the terminal because TUIs use it for navigation and interruption.

Anything else that might help:

resolvePreviewShortcutAction already returns closeActivePane. The missing behavior is at the preview boundary, where that action is grouped with unrelated pane-scoped actions and swallowed.

Activity

  1. AmethystLiang commented on Aug 12, 2026

    @AmethystLiang
    Contributor

    thanks for reporting. looking into it

  2. PannenetsF commented on Aug 31, 2026

    @PannenetsF
    Contributor

    Adding root-cause context and two concrete implementation options, in case it helps whoever picks this up.

    Root cause (from git history)

    The swallow is not a deliberate "don't support close" decision — it's a side effect of PR #11015 (fix(dashboard): give the agent preview terminal a real pane's keyboard, commit 1df8aa5605). That PR's actual goal was making the preview reuse the pane's resolveTerminalShortcutAction so word/line kills, Option chords, and modified Enter encode identically to a real pane. Once the preview ran the pane policy, it started resolving pane-scoped actions that have no target in a preview (split/search/focus/close), and xterm would otherwise encode them as stray bytes (e.g. Ctrl+Shift+D → bare Ctrl+D). So the whole group got consumeEvent()-ed.

    closeActivePane was simply lumped into that "no-target pane action" list alongside clearActivePane, splitActivePane, focusPane, toggleSearch, etc. — the author was thinking "don't leak bytes to the shell," not "should Cmd+W close this dialog."

    Worth noting: a follow-up commit in the same PR deliberately enumerated these cases instead of using a default, with the rationale that "a newly added action has to be classified here, not silently swallowed." So preview-terminal-key-handler.ts is by design the boundary where each pane action's preview behavior is decided — reclassifying closeActivePane from "swallow" to "close the dialog" fits that intent rather than working against it.

    Implementation sketch

    The fix lives entirely at the preview boundary (src/renderer/src/components/dashboard-popout/preview-terminal-key-handler.ts, the closeActivePane case around line 203). Thread a close callback down through the context so that branch calls it instead of only consuming:

    1. Add an optional onRequestClose?: () => void to PreviewShortcutContext (preview-terminal-shortcuts.ts).
    2. In the closeActivePane case, call it (then still consumeEvent) instead of just swallowing.
    3. Thread the dialog's existing close (onOpenChange(false)) from AgentTerminalDialog / AgentTerminalPanel → AgentTerminalPreview → installPreviewTerminalKeyHandler's getShortcutContext. AgentTerminalPreview doesn't currently receive a close callback, so that's the one new prop.

    User remaps of terminal.closePane flow through automatically since the resolution already reads useAppStore keybindings.

    The one decision that needs a maintainer call

    There's a cross-platform ambiguity that determines the scope of the fix: Ctrl+W is the shell's word-delete on Linux/Windows, and under the terminal-first shortcut policy a remapped tab.close is meant to yield to the shell there (PR #11015 already handles that for tab.close). So "always close on the pane-close chord while the terminal is focused" would override word-delete for terminal-heavy Linux/Windows users. Two reasonable designs:

    • Option A (conservative): Only close on the pane-close chord when focus is outside the terminal (symmetric with the existing Esc behavior); inside the terminal, keep yielding the bytes to the shell. Zero conflict, but doesn't solve the main pain point (no keyboard close while typing in the preview).
    • Option B (solve the pain point): Close the preview on the pane-close chord even when the terminal is focused. Fully fixes the reported behavior. On macOS this costs nothing (word-delete there is Opt+Delete); the tradeoff is only for Linux/Windows terminal users whose Ctrl+W word-delete would be shadowed. Could be narrowed to "Option B on macOS, Option A on Linux/Windows" to get both.

    Happy to implement whichever direction you prefer — just let us know which tradeoff you want.

  3. added theissue type on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingos:macosIssues affecting macOS

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions