Repository navigation
refactor(store): delete direct-SSH terminal ledgers - #27569
Conversation
Panes stopped spawning on unconverted ssh: rows in #27489, so the retry, live-binding and history ledgers were written but never read. Delete them, the retry and settle actions, and the detach transfer. The disconnect and new-authority clears keep nulling stale ssh: PTY ids exactly as before.
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The change removes unused Direct SSH retry state and should not alter runtime behavior. The reliability-gate records contain inaccurate test descriptions and evidence entries that should be corrected, but they do not block merge. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Replace the deleted-ledger assertion reference. · reliability-gates.jsonc:13262
config/reliability-gates.jsonc:13262
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winReplace the deleted-ledger assertion reference.
terminals-hydration.test.tsnow asserts retained deferred SSH-session behavior. It does not assert pruning of the removed retry, live-binding, or retry-history ledgers.Suggested fix
- "authoritative target-tab deletion prunes only that tab's retry, live-binding, and retry-history ledgers", + "hydration preserves deferred SSH session IDs for present targets and drops them for known-absent targets",
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
35527140-a191-45b3-bce6-f6c25afd31a4
📒 Files selected for processing (38)
config/reliability-gates.jsoncconfig/scripts/ci-shard-timings.jsonconfig/scripts/ssh-cleanup-tab-map-benchmark.mjssrc/renderer/src/hooks/direct-ssh-runtime-wake-isolation.test.tsxsrc/renderer/src/hooks/ipc-events-ssh-authority-test-fixtures.tssrc/renderer/src/hooks/ipc-events/direct-ssh-bridge-runtime.tssrc/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.tssrc/renderer/src/hooks/ipc-events/direct-ssh-state-ipc-bridge.tssrc/renderer/src/hooks/ssh-reconnect-pane-retry.test.tssrc/renderer/src/hooks/ssh-reconnect-pane-retry.tssrc/renderer/src/hooks/useIpcEvents-agent-status-ssh-authority.test.tssrc/renderer/src/store/slices/bulk-worktree-purge-terminal-maps-leak.test.tssrc/renderer/src/store/slices/direct-ssh-pane-detach-ledger.test.tssrc/renderer/src/store/slices/direct-ssh-pane-retry-ledger.tssrc/renderer/src/store/slices/direct-ssh-terminal-authority-ledger.tssrc/renderer/src/store/slices/direct-ssh-terminal-recovery-types.tssrc/renderer/src/store/slices/direct-ssh-terminal-recovery.test.tssrc/renderer/src/store/slices/direct-ssh-terminal-recovery.tssrc/renderer/src/store/slices/direct-ssh-terminal-retry.test.tssrc/renderer/src/store/slices/ssh-target-cleanup.tssrc/renderer/src/store/slices/ssh.test.tssrc/renderer/src/store/slices/store-active-worktree-terminal-creation.test.tssrc/renderer/src/store/slices/terminals-hydration.test.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/slices/worktrees/teardown/worktree-purge-omitters.tssrc/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.tssrc/renderer/src/store/terminals/direct-ssh-terminal-bindings.tssrc/renderer/src/store/terminals/terminal-actions.tssrc/renderer/src/store/terminals/terminal-disowned-pty-sources.tssrc/renderer/src/store/terminals/terminal-layout-state.tssrc/renderer/src/store/terminals/terminal-pty-bindings.tssrc/renderer/src/store/terminals/terminal-pty-release.tssrc/renderer/src/store/terminals/terminal-state.tssrc/renderer/src/store/terminals/terminal-tab-close-intent.test.tssrc/renderer/src/store/terminals/terminal-tab-close.tssrc/renderer/src/store/terminals/terminal-tab-recovery-ledger.tssrc/renderer/src/store/terminals/workspace-terminal-hydration-patch.tssrc/shared/terminal-tab-types.ts
💤 Files with no reviewable changes (23)
- src/renderer/src/store/slices/terminals.ts
- src/renderer/src/hooks/ssh-reconnect-pane-retry.test.ts
- src/renderer/src/store/slices/direct-ssh-terminal-retry.test.ts
- src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts
- src/renderer/src/store/terminals/terminal-disowned-pty-sources.ts
- src/renderer/src/store/slices/direct-ssh-terminal-recovery-types.ts
- src/shared/terminal-tab-types.ts
- src/renderer/src/store/terminals/workspace-terminal-hydration-patch.ts
- src/renderer/src/store/terminals/terminal-tab-close-intent.test.ts
- src/renderer/src/hooks/ipc-events-ssh-authority-test-fixtures.ts
- src/renderer/src/store/terminals/terminal-tab-close.ts
- src/renderer/src/store/slices/direct-ssh-pane-detach-ledger.test.ts
- src/renderer/src/hooks/ssh-reconnect-pane-retry.ts
- src/renderer/src/store/slices/direct-ssh-pane-retry-ledger.ts
- src/renderer/src/store/slices/ssh-target-cleanup.ts
- config/scripts/ssh-cleanup-tab-map-benchmark.mjs
- src/renderer/src/store/slices/worktrees/teardown/worktree-purge-omitters.ts
- src/renderer/src/store/terminals/terminal-layout-state.ts
- src/renderer/src/store/slices/terminals-hydration.test.ts
- src/renderer/src/store/terminals/terminal-state.ts
- src/renderer/src/store/slices/bulk-worktree-purge-terminal-maps-leak.test.ts
- src/renderer/src/store/slices/direct-ssh-terminal-authority-ledger.ts
- config/scripts/ci-shard-timings.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| "runner": "local", | ||
| "platform": "macos", | ||
| "command": "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/store/slices/direct-ssh-terminal-retry.test.ts src/renderer/src/store/slices/direct-ssh-pane-detach-ledger.test.ts src/renderer/src/store/slices/direct-ssh-terminal-recovery.test.ts src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/hooks/direct-ssh-reconnect-coordinator.test.ts src/renderer/src/hooks/direct-ssh-host-hydration.test.ts src/renderer/src/hooks/direct-ssh-state-routing.test.ts src/renderer/src/components/terminal-pane/pty-connection-pending-spawn.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot", | ||
| "command": "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/store/slices/direct-ssh-terminal-recovery.test.ts src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/hooks/direct-ssh-reconnect-coordinator.test.ts src/renderer/src/hooks/direct-ssh-host-hydration.test.ts src/renderer/src/hooks/direct-ssh-state-routing.test.ts src/renderer/src/components/terminal-pane/pty-connection-pending-spawn.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot", |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Keep these historical commands aligned with their recorded results.
Lines 13320 and 13356 now list commands with nine test files, but their summaries report 14 files/155 tests and 12 files/647 tests. Preserve the original commands that produced those results, or rerun the narrowed commands and update each result, duration, and summary.
Also applies to: 13356-13356
ELI5
When Orca still had its old SSH relay, a terminal on an SSH project kept a small notebook in memory: which shell attempt was in flight, which one was bound to the tab, and how many times it had retried. #27489 stopped those terminals from ever starting a shell over the relay, because nothing can serve one any more. The notebook kept getting written but nothing read it. This PR throws the notebook away.
What Changed
Before: the terminal store carried three in-memory maps for relay-era SSH tabs (
directSshPaneRetryByTabId,directSshLivePtyBindingByTabId,directSshPaneRetryHistoryByTabId), plusretryDirectSshTargetPanesandsettleDirectSshPaneRetry. When an SSH host connected or the machine woke, the retry action bumped each unconvertedssh:tab's generation, which remounted the pane.After: the maps, both actions, the split-detach ledger transfer and the retry predicate are gone. For the user, nothing changes. Since #27489 a pane on an unconverted
ssh:row uses an inert transport, so that remount only rebuilt the same inert pane. The host was already connected, so the pane's mount dial skipped. The host's conversion re-homes the workspace to its managed server, and that move remounts the pane. It never depended on this bump.Mechanism:
clearDirectSshTargetPtyBindings(disconnect) is unchanged.invalidateStaleDirectSshTargetPtyBindings(new authority) is now the same clear, still gated on the authority being current. No pane binds anssh:PTY any more, so the old "stale" test (a PTY id without a matching live binding) matched every bound tab anyway. One narrow exception: detaching a split pane out of a relay-era tab that still had a pending retry could copy a live-binding entry onto the new tab. That kept the new tab's stale relay id instead of nulling it. The pane is inert either way, and the leaf, last-known and deferred ids are kept, so nothing visible or saved changes. The wake and preparation correction path calls that clear too, as the retry did internally first. Stale relay-era PTY ids are dropped at exactly the moments they were dropped before.updateTabPtyIdloses its fourthdirectSshRetryAttemptIdargument. No production caller passed it after refactor(terminal): panes have two transports, local or remote runtime #27489, so its lease branch could never run.clearTabPtyIdloses its "continuation gap", which needed a live binding that is never written.retryTargetPanesdependency now returns 0. The only effect is that its telemetry counts no retried terminals.Kept on purpose (scope shrunk from the plan):
lastKnownRelayPtyIdByTabIdanddeferredSshSessionIdsByTabIdstay. The plan listed them as unpersisted. But the first is written on every PTY bind, for local and remote tabs too. The second is filled at cold start from saved relay-era sessions. Both feed the workspace-session writer (buildTerminalSessionDatafalls back to them for a tab whoseptyIdis null), the orphan sweep and the resource manager. Removing either would change what gets saved for legacy profiles in the ≤1.4.223 window. Nothing in the saved session shape changes here.Why
This is Phase 3.99 C2. Every terminal-store change had to thread three dead maps through close, purge, hydration, target removal and PTY release. I considered keeping the generation bump on connect as a "free remount". But it races the conversion's catalog load: the bump fires synchronously on the connected push, before the server's rows arrive. So it always remounted into the same inert pane, and the conversion's re-home is what actually moves the pane.
Proof the code is dead.
rgfor every removed symbol (directSshPaneRetryByTabId,directSshLivePtyBindingByTabId,directSshPaneRetryHistoryByTabId,retryDirectSshTargetPanes,settleDirectSshPaneRetry,transferDirectSshPaneDetachLedger,shouldRetryPaneSpawnOnSshReconnect,isPtyBindingStillAddressable,DirectSshPaneRetryAttemptId,DirectSshPaneRetryResult,omitRetiredDirectSshLedgerByTabId,directSshRetryAttemptId…) oversrc config tests mobile .githubfinds none left. A per-symbolrg -wover all 159@ts-nocheckfiles finds 0. The only hits left are a historical audit snapshot underdocs/audits/.pnpm tc,build:electron-viteandbuild:clipass.Net lines: production −938 (+32 / −970); tests −1,494 (+32 / −1,526); config −43.
Linked Issue
Phase 3.99 (owner-approved cleanup plan), PR C2. Depends on #27489 (merged).
Visual Proof
N/A. No UI change. The only path that changes is the redundant remount of an inert relay-era pane, which drew the same pane again.
Testing
pnpm tc;pnpm lint(all ratchets at or below baseline);pnpm run check:code-quality:changed;pnpm run build:electron-vite;pnpm run build:cli.pnpm test src/renderer/src/store src/renderer/src/hooks src/renderer/src/lib/workspace-session* src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts: 611 files, 5,353 tests.Changed tests:
direct-ssh-runtime-wake-isolationnow asserts that a wake clears only the exact direct target, that a stale authority is a no-op, and that runtime-owned panes are untouched. The connect-reply routing tests observe the coordinator through the clear instead of the retry. Tests of the deleted ledgers (direct-ssh-terminal-retry,direct-ssh-pane-detach-ledger,ssh-reconnect-pane-retry) are deleted, and the reliability gate is updated to match.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
P0/P1 review: self + independent reviewer; reports in the Phase 3.99 review folder.
Agent skill upstream boundary
Notes
ssh:row is never treated as local orexited. Stale relay PTY ids are cleared at the same moments as before. A managed host isruntime:<env>and outside the cleared scope.providerEpoch/connectionGeneration.resolveDirectSshTerminalKeys, unchanged.disownedPtyIdsis now written but not read (its only reader was the deleted retry predicate). Its producer crosses preload, so it stays out of this PR.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)