Repository navigation
refactor(pty): drop SSH spawn, liveness and kill branches - #27529
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to PTY routing and stop handling are simplified; no user-visible regression is established, so no demonstrated issue blocks merging. Pre-merge checks |
|
7569ab2 to
3c580ef
Compare
3c580ef to
77864c7
Compare
ELI5
A terminal can only be started, checked or stopped by this app when it runs on this computer. Terminals on an SSH host are run by that host's own Orca server. The terminal code still had extra branches for the old way of driving SSH terminals directly, through a relay that was deleted earlier in this phase. Those branches could no longer run, so this PR removes them. Nothing changes for the user.
What Changed
Before and after, as the user sees it: no difference. Local, WSL, folder-workspace and paired-server terminals start, reattach and stop exactly as before. A terminal left over from the old SSH relay era (an
ssh:id) still gets the same treatment when it is closed: its old lease is marked terminated, it reports a synthetic exit, and its liveness staysunverifiable, neverexited.The mechanism:
pty:spawnpath and the runtime/CLI path). Since refactor(pty): delete the SSH PTY provider and its registry slot #27499, the provider lookup at the top of preflight throwsPtyHostNotDispatchableErrorfor any SSH connection. Nothing after that line can see aconnectionId, so everyconnectionIdbranch after it is removed: the SSH env stripping, the relay "session expired" handling that marked a leaseexpired, the relay id bookkeeping (effectiveSessionRelayId), the SSH binding host in the commit, and the SSH lease claim (pane/ssh-pane-lease-claim.ts). One comment now marks the preflight line where only local spawns continue. Three helpers that were only called after that line lose theirconnectionIdparameter:recoverFreshSpawnProviderRouting,withClaudeProfileTerminalEnvandpersistAdmittedStablePaneBinding.swapReplacedPaneBindingandsetAdoptedPtyOwnershiplose theirs too.providers/ssh-pty-errors.tsis deleted. Its error classes were constructed only by the relay provider that refactor(pty): delete the SSH PTY provider and its registry slot #27499 deleted.isPtyAlreadyGoneErrorkeeps only the daemon'sSession not foundmatch. Stable-pane adoption now checksSessionNotFoundErrordirectly. That is the same verdict as before, because the two relay-only predicates could no longer be true.runtime/undelivered-ssh-kill.tsis deleted, along with the controller'srecordUnconfirmedStop. They wrote a "replay this kill on the next relay handshake" order that nothing in this build reads. The runtime close reply therefore never setspendingKillRecorded. It already never did on a real path: anssh:PTY is marked unregistered before that call, and a local PTY always returned false. The shared wire type keeps the optional field for older hosts. Provider-path checks onconnectionIdare removed, because a provider exists only for local PTYs.OrcaRuntime.acceptPtyDataBoundedandresetPtyModelAfterMigrationFailureare removed, along with theonPtyDatareceipt parameter and theRuntimePtyDataAdmissiontype. They had no production caller. Three tests that used them now driveonPtyData, or usepreparePtyExecutionContext(…, { resetIncarnation: true }), which runs the same dispose.Net lines: production about −560 (+195 / −756), tests about −640 (+56 / −697).
Why
New terminal work no longer has to step around relay branches that cannot run. Each removed arm either sat after a point that already throws for SSH, or was keyed on an error type that nothing constructs any more. Where an
ssh:PTY can still arrive (closing a relay-era tab), the existing typed handling is kept and it never falls through to the local provider (Phase 3.99 principle 8). A wider sweep ofconnectionIdin the files that run before preflight (spawn-begin, spawn-early, spawn-options and the stable-owner lookup) was left out. Those run before the dispatch point and belong to their own callers' PRs.Persisted relay-era data keeps today's load and save semantics. The one persisted write no longer made is the undelivered-kill intent, which this build never reads. A5 retires its writer domain.
Proof that the removed code is unreachable:
rgoversrc config tests mobile .githubfor every removed symbol (stripRemotePaneEnvWhenHooksDisabled,isHostReportedPtyAbsenceError,isObservedPtyExitEvidence,isSshPty*,SshPty*RelayError,claimSshPaneLease,recordUndeliveredSshPtyKill,recordUnconfirmedExplicitSshStop,recordUnconfirmedStop,acceptPtyDataBounded,resetPtyModelAfterMigrationFailure,RuntimePtyDataAdmission,captureModelReceipt,effectiveSessionRelayId, and the three deleted module paths) finds 0 hits. The same scan over all 159// @ts-nocheckfiles also finds 0 hits. The renderer keeps its ownSSH_PTY_IDENTITY_MISMATCHstring constant for older hosts.PTY "<id>" not foundwording exists (the daemon raisesSession not found: <id>).build:electron-vite,build:cliandbuild:orcadpass.Linked Issue
Phase 3.99 cleanup, PR A4 (internal plan). No issue.
Visual Proof
N/A. This is a behaviour-preserving deletion with no UI change.
Testing
pnpm tc, oxlint,pnpm run check:code-quality:changed(0 new findings),pnpm lint. Vitest suites:src/main/ipc(all suites),src/main/runtime, andsrc/main/claude-accounts. Two SSH-only suites were deleted because the code they tested is gone:pty-ssh-undelivered-kill.test.tsandspawn-commit-ssh-lease-cardinality.test.ts. Two persistence commit-durability tests that called the commit step directly with an SSH connection (a path preflight now refuses) run through local PTYs only. The relay-error stable-pane tests were rewritten to use the daemon'sSessionNotFoundError, and the file was renamedstable-pane-absence-respawn.test.ts. The routing test still pins thatPtyHostNotDispatchableErroris never read as gone or as an observed exit. I did not run Electron or Docker locally; CI covers those lanes.Review
Self-review plus an independent read-only reviewer. P0/P1 only.
Agent skill upstream boundary
Notes
ssh:PTY staysunverifiable.pendingKillRecordedstays optional in the shared type.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)