Skip to content

fix(dashboard-popout): forward macOS IME native-text commits in the preview terminal - #9771

Merged
brennanb2025 merged 8 commits into
brennanb2025/popout-terminal-copy-pastefrom
brennanb2025/popout-ime-input
Jul 21, 2026
Merged

brennanb2025 merged 8 commits into
brennanb2025/popout-terminal-copy-pastefrom
brennanb2025/popout-ime-input

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

CJK/IME input can be silently dropped in the popped-out dashboard's terminal dialog (found in a popout functionality audit). The preview terminal enables xterm's kitty keyboard protocol via buildDefaultTerminalOptions, and when the agent TUI has kitty mode active, xterm's encoder can encode + cancel a printable keydown before Chromium commits the real IME/native text — dropping certain macOS input-source commits and synthetic Unicode injection. Main-window panes guard this with terminal-ime-native-text-forwarder; the pop-out preview never installed it.

Fix

Mirror the TerminalPane install (macOS-only, like the pane's):

  • Install installTerminalImeCompositionTracker + installTerminalImeNativeTextForwarder on the preview terminal's element once it opens.
  • Initialize the shared macOS input-source tracker at terminal setup, so its async classification is warming before the first physical CJK punctuation or Vietnamese replacement key arrives.
  • Claim native-text key events at the top of the preview's existing custom key handler (xterm supports only one attachCustomKeyEventHandler, so the claim composes with the copy/paste chords from fix(dashboard-popout): wire terminal copy/paste in the popped-out window #9765 rather than replacing them). Claimed keydowns bypass the kitty encoder; the committed glyph is forwarded from the input event via terminal.input(), which flows through the preview's existing user-input routing to the PTY.
  • Clean up both per-terminal disposables on unmount and on the PTY-gone teardown path.

Ordinary composition-based IME typing was already fine; this covers the kitty-mode native-commit path (e.g. agents like Claude Code that enable kitty keyboard mode).

Stacking

Based on brennanb2025/popout-terminal-copy-paste (#9765) because both PRs modify the same custom key handler in AgentTerminalPreview.tsx — merge #9765 first. The latest #9765 head is merged into this branch.

Reliability and performance

  • Invariant / gate: terminal-input.ime-and-synthetic-forwarding — native-text commits must reach the intended PTY exactly once, without xterm sending the swallowed key first.
  • Failure source: a popped-out macOS terminal running a kitty-keyboard TUI can consume the keydown before Chromium emits the native-text commit.
  • Oracle: component coverage proves macOS-only installation, eager one-time input-source tracker initialization, committed text routing through xterm's user-input signal to the selected ptyId exactly once, claimed-event bypass without breaking clipboard chords, and single cleanup on both unmount and PTY loss.
  • Platform/provider coverage: macOS is the changed path; Linux and Windows do not install the bridge. PTY provider ownership and transport are unchanged because the bridge feeds the preview's existing terminalPreview.input(ptyId, data) route.
  • Performance budget: one renderer-wide input-source tracker is initialized once; feature reads and key classification are constant-time. No polling loop, output-path work, session scan, subprocess, or per-key IPC was added. Per-terminal DOM listeners are released on terminal teardown.
  • Diagnostics / residual gap: deterministic tests identify install, routing, and cleanup failures. A real macOS pop-out IME automation soak and the broader CJK/Vietnamese/Arabic matrix remain unproved, matching the experimental gate's registered gaps.

Tests

  • 28/28 dashboard-popout tests pass.
  • 190/190 focused dashboard, xterm user-input, IME, paste-runtime, and bypass-policy tests pass.
  • Full node/CLI/web TypeScript typecheck passes; changed-file Oxlint, reliability-manifest validation, max-lines ratchet, and diff checks pass.
  • The repository-wide suite reached 33,474 passing tests. Its 43 unrelated failures reproduce under the unsupported local Node 26 runtime (localStorage is unavailable there, plus two environment-sensitive relay assertions); the project/CI runtime is Node 24.

brennanb2025 and others added 8 commits July 21, 2026 13:01
…review terminal

The preview terminal enables xterm's kitty keyboard protocol (via
buildDefaultTerminalOptions), whose encoder can encode and cancel a
printable keydown before Chromium commits the real IME/native text —
silently dropping macOS input-source commits and synthetic Unicode
injection. Main-window panes guard this with the IME native-text
forwarder; the pop-out preview never installed it.

Install the composition tracker + forwarder (macOS-only, mirroring
TerminalPane) and claim native-text key events at the top of the
preview's custom key handler so the committed glyph reaches the PTY via
terminal.input() and the existing user-input routing.
…y-paste' into brennanb2025/popout-ime-input

# Conflicts:
#	src/renderer/src/components/dashboard-popout/AgentTerminalPreview.test.tsx
@brennanb2025
brennanb2025 merged commit 0b53275 into brennanb2025/popout-terminal-copy-paste Jul 21, 2026
14 checks passed
brennanb2025 added a commit that referenced this pull request Jul 21, 2026
…dow (#9765)

* fix(dashboard-popout): wire terminal copy/paste in the popped-out window

The Edit menu's Paste is a custom item that routes Cmd/Ctrl+V to the
focused window as ui:appMenuPaste, and only the main window's React root
listens for it — the popout dropped it, so paste silently did nothing.
The copy chord similarly resolves in the main window's before-input-event
handler, which the popout window never registers; the menu's role:'copy'
no-ops on xterm's empty hidden textarea.

AgentTerminalPreview now subscribes to onAppMenuPaste (guarded on focus
inside the preview) and pastes via terminal.paste(), which xterm flags as
user input so the existing preview->PTY routing and main-process input
limits apply. A custom key handler honors the terminal.copySelection and
terminal.paste keybindings, skipping plain Mod+V since the menu
accelerator owns that chord (handling it twice would paste double). The
popout bootstrap fetches keybinding overrides so custom bindings apply.

* fix(dashboard-popout): harden terminal clipboard routing

* fix(dashboard-popout): authorize terminal clipboard text

* test(dashboard-popout): harden terminal paste coverage

* fix(terminal): normalize streamed paste newlines

* fix(dashboard-popout): forward macOS IME native-text commits in the preview terminal (#9771)

* fix(dashboard-popout): forward macOS IME native-text commits in the preview terminal

The preview terminal enables xterm's kitty keyboard protocol (via
buildDefaultTerminalOptions), whose encoder can encode and cancel a
printable keydown before Chromium commits the real IME/native text —
silently dropping macOS input-source commits and synthetic Unicode
injection. Main-window panes guard this with the IME native-text
forwarder; the pop-out preview never installed it.

Install the composition tracker + forwarder (macOS-only, mirroring
TerminalPane) and claim native-text key events at the top of the
preview's custom key handler so the committed glyph reaches the PTY via
terminal.input() and the existing user-input routing.

* fix(dashboard-popout): prewarm IME input source

* fix(skills): preserve released history across new tags (#9778)

Co-authored-by: OrcaWin <[email protected]>

* fix(skills): record latest Linear release history (#9777)

---------

Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: OrcaWin <[email protected]>

---------

Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: OrcaWin <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…dow (stablyai#9765)

* fix(dashboard-popout): wire terminal copy/paste in the popped-out window

The Edit menu's Paste is a custom item that routes Cmd/Ctrl+V to the
focused window as ui:appMenuPaste, and only the main window's React root
listens for it — the popout dropped it, so paste silently did nothing.
The copy chord similarly resolves in the main window's before-input-event
handler, which the popout window never registers; the menu's role:'copy'
no-ops on xterm's empty hidden textarea.

AgentTerminalPreview now subscribes to onAppMenuPaste (guarded on focus
inside the preview) and pastes via terminal.paste(), which xterm flags as
user input so the existing preview->PTY routing and main-process input
limits apply. A custom key handler honors the terminal.copySelection and
terminal.paste keybindings, skipping plain Mod+V since the menu
accelerator owns that chord (handling it twice would paste double). The
popout bootstrap fetches keybinding overrides so custom bindings apply.

* fix(dashboard-popout): harden terminal clipboard routing

* fix(dashboard-popout): authorize terminal clipboard text

* test(dashboard-popout): harden terminal paste coverage

* fix(terminal): normalize streamed paste newlines

* fix(dashboard-popout): forward macOS IME native-text commits in the preview terminal (stablyai#9771)

* fix(dashboard-popout): forward macOS IME native-text commits in the preview terminal

The preview terminal enables xterm's kitty keyboard protocol (via
buildDefaultTerminalOptions), whose encoder can encode and cancel a
printable keydown before Chromium commits the real IME/native text —
silently dropping macOS input-source commits and synthetic Unicode
injection. Main-window panes guard this with the IME native-text
forwarder; the pop-out preview never installed it.

Install the composition tracker + forwarder (macOS-only, mirroring
TerminalPane) and claim native-text key events at the top of the
preview's custom key handler so the committed glyph reaches the PTY via
terminal.input() and the existing user-input routing.

* fix(dashboard-popout): prewarm IME input source

* fix(skills): preserve released history across new tags (stablyai#9778)

Co-authored-by: OrcaWin <[email protected]>

* fix(skills): record latest Linear release history (stablyai#9777)

---------

Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: OrcaWin <[email protected]>

---------

Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: OrcaWin <[email protected]>
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