Repository navigation
Fix terminal paste cancellation after xterm focus replacement - #16819
brennanb2025 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe terminal paste flow now captures a dispatch-time focus snapshot with the focused element and pane ownership. Clipboard and app-menu paste paths pass this snapshot through paste execution. Focus validation accepts dispatch focus outside the pane and continues to validate pane-owned focus changes. Tests cover retained focus, focus changes, transient blur, helper replacement, and non-pane-owned dispatch focus. Merge Risk: ⚪ Minimal · up to This localized change corrects terminal paste handling when xterm replaces its internal input while preserving pane and terminal ownership checks; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is mostly complete. It includes the ELI5, change summary, rationale, linked issue, visual proof, testing results, review notes, scope considerations, and checklist status. It also clearly documents that some platform-specific validation and full required commands remain unverified.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review verification (exact head 44b98f3 / PR #16819): completed three focused adversarial passes over pane-focus ownership, xterm helper replacement, pane/leaf/transport/PTY guards, lifecycle, remote/folder boundaries, and stale-branch behavior. No proven in-scope issues found; no production edits were needed. |
Review loop r1 — recommend superseding this PRReviewed Why I think it's a no-opThe diff changes exactly one thing: when
Differential: I ran the pre-fix and post-fix predicates side by side over a real DOM built to match the live pane structure, with 12 focus candidates used as both the dispatch focus and the execute focus, crossed with On the red/green claimIt reproduces — ablating the Ablation table
That third row is a real gap regardless of the rest: the negative test hand-builds Can a paste still be silently dropped? Yes — and not from this code pathMeasured in a dev build: with focus outside the terminal container ( Once a paste actually executes, drops are not silent: every non- Other things checked
SuggestionI'd supersede rather than patch. The two reachable defects look like: a paste aimed at a terminal whose pane doesn't hold DOM focus is discarded with no signal (routing is Not verified: live mid-paste PTY-replacement run, Linux/Wispr Flow reproduction, Windows/ConPTY, packaged build (dev-mode CDP is blind to packaged regressions), physical SSH, relay, paired web, and mobile legs. |
|
Closing because the helper-replacement premise does not occur in the current terminal lifecycle, so this change does not repair the reported paste failure. I reviewed the full diff at
The actual inert-focus routing and clipboard-read-error cases remain useful work and are addressed separately by #17020. This closure does not claim that the reported Linux/Wispr failure is fixed, and is unrelated to merge conflicts. If a real helper-detachment path is found, that evidence would justify revisiting this guard. |

ELI5
A paste could begin in the right terminal, wait for the clipboard, and then be cancelled because xterm replaced its hidden input element during that wait. Orca now remembers that the original input belonged to the pane, then accepts xterm's valid replacement only while the same pane and PTY still own focus.
In plainer words: you click into a terminal pane and press paste. Orca has to go and fetch the
clipboard, which takes a moment. During that moment the terminal widget sometimes quietly swaps out
the invisible box that receives your keystrokes — normal behaviour on its part. Orca was checking
"is the exact box I started with still on screen?", found a different one, decided the paste must be
aimed somewhere else, and cancelled it. Your text never arrived, even though the pane was right
there still accepting typing. Orca now checks the thing that actually matters — that the same pane
and the same running terminal still hold focus.
User-facing before / after
When it bites
Reported on Linux, where the hidden-input replacement is most frequent, but the code path is the same
on every platform. It hits anyone pasting into a terminal pane, and it looks like the paste silently
did nothing.
What Changed
Why
STA-3834 / #13623 reports Linux pastes being cancelled even though input to the same pane remains available. The stale guard rechecked whether the original xterm helper was still contained after asynchronous clipboard reading; when xterm detached and replaced that helper, Orca rejected the valid current target.
Linked Issue
Fixes #13623
Linear: https://linear.app/stably/issue/STA-3834/bug-paste-cancelled
Visual Proof
The focused Electron journey delays clipboard delivery, replaces the xterm helper during the wait, and proves the marker reaches the terminal. It passed three consecutive recorded runs.
page@e8e076686077dc6a81c0e9b812d12162.webm
Baseline proof is deterministic rather than visual: the new helper-replacement unit contract failed before the fix (
expected true, received false) and passes with this commit.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
pnpm testacross 8 focused terminal clipboard/paste suites: 96 passed.pnpm tc:web: passed.Explicit
oxlintandoxfmt --checkon all 3 changed files: passed.Electron Playwright clipboard-blur journey: passed once in the focused validation and 3/3 in the recorded visual-proof run.
E2E-mode Electron bundle: passed.
pnpm run check:code-quality:changed: blocked before lint by a pre-existing Node 26 engine-warning JSON parse failure; direct changed-file lint passed.Actual Linux desktop + Wispr Flow reproduction remains unverified; validation used the shared renderer path in Electron on macOS.
Review
Two adversarial review-until-clean rounds found no remaining in-scope issues. The scope excludes STA-5272's broader deferred-paste feature and cancellation-presentation changes.
Terminal reliability contract
terminal-input.paste-focus-ownership): a paste started in a terminal pane may survive xterm helper replacement only while current focus remains in that pane and pane/leaf/transport/PTY identity is unchanged.config/reliability-gates.jsonchas no dedicated paste-focus gate; the focused unit and Electron tests are not yet a manifest gate.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No wire, persisted-state, Git, filesystem, path, shell, provider, or subprocess contract changes. Folder workspaces and Git providers are unaffected.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)