Skip to content

refactor(terminal): paste reads the live transport - #27572

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-C3
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-C3

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​353 $\color{#cf222e}{\Huge{\mathbf{−}}}$​338
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​74 $\color{#cf222e}{\Huge{\mathbf{−}}}$​66

ELI5

When you paste or drop files into a terminal, Orca decides how to format the text for the machine the terminal runs on. It used to look at two things: the terminal's live connection, and a guess based on the workspace's SSH setting. The guess only mattered for the old SSH relay, which is gone. This PR removes the guess, so the terminal's live connection is the only source.

What Changed

  • resolveTerminalPasteRuntime takes only the live transport and the PTY id. It no longer takes connectionId or remotePlatform, and it has no 'ssh' kind. The kinds left are local, WSL and remote runtime.
  • 7 caller sites stop working out the workspace's SSH connection and the relay host's platform just to pass a fallback. These are the keyboard/menu/middle-click/programmatic paste callers, internal and native drop, and cold-restore startup paste.
  • Deleted terminal-paste-ssh-platform.ts.
  • resolveTerminalDropTargetShell drops remotePlatform. A relay-era ssh: row now always gets POSIX quoting.
  • useTerminalPaneGlobalEffects and handleTerminalProgrammaticTextPaste no longer take a worktreeId. Their only use for it was the removed lookup.

Before and after for users: no visible change. Since #27489 (C1), no pane transport carries a relay connection. Local and WSL panes use the IPC transport, which is never given a connectionId, and paired runtime panes report getConnectionId() === null. So the 'ssh' branch could only run on a relay-era ssh: row. That row's pane holds an inert transport that rejects every write, and its file upload goes through importExternalPathsSsh, which already throws in production. On those rows the paste or drop still fails exactly as before. The only difference is the label and quoting the paste planner computes before the write is refused.

Net lines: production −66 (+8/−74), tests −338 (+15/−353).

Why

This is Phase 3.99 C3 (design K17 / survey R3). Every paste entry point copied the same fallback, and the live transport already overrode it. Keeping it meant each new paste path had to repeat a relay-era lookup. I chose to remove the 'ssh' kind instead of leaving it unreachable, because a kind that can never be produced makes readers think SSH panes still paste through it. Managed SSH hosts paste as remote-runtime.

Linked Issue

Maintainer PR. Part of Phase 3.99 (stack entry C3, depends on C1 #27489).

Visual Proof

N/A: no reachable UI or interaction change (see above).

Testing

  • Proof that the code is dead: rg for terminal-paste-ssh-platform / getTerminalPasteSshRemotePlatform over the whole repo, including the @ts-nocheck files, returns nothing. No @ts-nocheck file calls a changed signature. pnpm run build:electron-vite passes. The change is renderer-only, so CLI and orcad bundles are unaffected.

  • No caller depends on the fallback when it has no transport. A paste with no live transport still writes nothing (terminal-programmatic-text-paste.test.ts: "does not direct-paste through xterm when the pane has no live transport").

  • pnpm tc, pnpm lint, oxlint, pnpm run check:code-quality:changed (0 new findings).

  • Focused tests: all 22 suites that import a changed module pass (205 tests). The paste runtime suite keeps the local, WSL and remote-runtime cases. The coordinator matrix swaps its two SSH rows for a Windows remote-runtime row. Tests that only covered Windows relay-SSH quoting were removed (1 shell, 1 internal drop, 2 native drop).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Self-review plus an independent reviewer. Reports are under .build/runtime-strategy/phase399/reviews/C3-*.md.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Remote SSH: managed SSH hosts are paired runtimes and keep the remote-runtime paste kind and timeout. Windows: WSL detection is unchanged. Folder workspaces: unaffected, because the classification depends only on the transport. No wire change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Paste and drop planning no longer re-derive an SSH connection from the
worktree. After C1 no pane transport carries a relay connection, so the
'ssh' paste kind, the worktree fallback and terminal-paste-ssh-platform.ts
are gone.
@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 773d21f2-7be4-4fc4-8f7b-f150657c6332

📥 Commits

Reviewing files that changed from the base of the PR and between 47c9363 and 9735ae2.


📒 Files selected for processing (26)
  • src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-handler.test.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-handler.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-internal-handler.test.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-shell.test.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-shell.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-source-owner.test.ts
  • src/renderer/src/components/terminal-pane/terminal-native-file-drop.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-menu-paste.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-coordinator.test.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-executor.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-model.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-runtime.test.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-runtime.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-ssh-platform.ts
  • src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.test.ts
  • src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-active-pty-reporting.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-paste-events.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-sync-fit-registration.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-visibility-resume.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-window-focus-recovery.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-listeners.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-mobile-actions.ts

💤 Files with no reviewable changes (16)
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-paste-events.test.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-ssh-platform.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-source-owner.test.ts
  • src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-active-pty-reporting.test.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-internal-handler.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-listeners.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-window-focus-recovery.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-sync-fit-registration.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-menu-paste.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-visibility-resume.test.ts
  • src/renderer/src/components/terminal-pane/terminal-drop-handler.test.ts
  • src/renderer/src/components/terminal-pane/terminal-paste-runtime.ts
  • src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

Paste runtime resolution no longer selects an SSH runtime from connection or remote-platform metadata. It now classifies remote-runtime PTYs, local WSL sessions, and other local sessions. SSH drop targets resolve to POSIX, while worktree-based shell selection remains unchanged. Paste entry points and terminal pane effects no longer pass worktree or SSH platform data where it was previously used.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 9735a

No actionable paste or drop regression was identified. The PR is mergeable after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: terminal paste now reads the live transport.
Description check Passed The description follows the required template and explains the change, rationale, linked maintainer issue context, testing, compatibility impact, and lack of visual changes. It also records that manua…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin merged commit 8e536f9 into main Oct 11, 2026
37 checks passed
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.

1 participant