Repository navigation
refactor(renderer): delete the direct-SSH authority and reconnect coordinator - #27587
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
📥 Commits
You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to This change removes unused direct-SSH reconnect machinery and moves terminal-binding cleanup into the state bridge. No user-visible behavior change is expected. A few manifest descriptions still mention deleted tests and should be tidied. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e940e8ef-7a37-4013-a1ab-8002d97170c3
📥 Commits
Reviewing files that changed from the base of the PR and between d65e9be and defa9eef614827254a0c813d4641d8f6c6e6696c.
📒 Files selected for processing (83)
config/reliability-gates.jsoncconfig/scripts/ci-shard-timings.jsonsrc/main/ipc/repos-execution-host-catalog.test.tssrc/main/ipc/repos.tssrc/main/ipc/repos/host-repo-catalog-snapshot.tssrc/main/ipc/repos/repo-catalog-handlers.tssrc/main/ipc/worktree-create-lineage.test.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees-create-metadata-persistence.test.tssrc/main/ipc/worktrees-lineage-hydration.test.tssrc/main/ipc/worktrees.tssrc/main/ipc/worktrees/listing/detected-provider-listing.tssrc/main/ipc/worktrees/metadata/host-lineage-listing.tssrc/main/ipc/worktrees/metadata/lineage-owner-resolution.tssrc/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.tssrc/main/ipc/worktrees/metadata/workspace-lineage-candidate-scan.test.tssrc/main/ipc/worktrees/metadata/workspace-lineage-filtering.tssrc/main/ssh/orcad-retained-source-lists.test.tssrc/preload/api/repos-bridge.tssrc/preload/api/repository-api.tssrc/preload/api/worktree-api.tssrc/preload/api/worktrees-bridge.tssrc/renderer/src/hooks/direct-ssh-host-catalog-noop.test.tssrc/renderer/src/hooks/direct-ssh-host-hydration-scope.tssrc/renderer/src/hooks/direct-ssh-host-hydration-telemetry.tssrc/renderer/src/hooks/direct-ssh-host-hydration.test.tssrc/renderer/src/hooks/direct-ssh-host-hydration.tssrc/renderer/src/hooks/direct-ssh-reconnect-coordinator-outcomes.tssrc/renderer/src/hooks/direct-ssh-reconnect-coordinator-stabilization.tssrc/renderer/src/hooks/direct-ssh-reconnect-coordinator-telemetry.tssrc/renderer/src/hooks/direct-ssh-reconnect-coordinator-types.tssrc/renderer/src/hooks/direct-ssh-reconnect-coordinator.test.tssrc/renderer/src/hooks/direct-ssh-reconnect-coordinator.tssrc/renderer/src/hooks/direct-ssh-reconnect-preparation-metrics.tssrc/renderer/src/hooks/direct-ssh-reconnect-preparation.tssrc/renderer/src/hooks/direct-ssh-reconnect-rollout.test.tssrc/renderer/src/hooks/direct-ssh-reconnect-rollout.tssrc/renderer/src/hooks/direct-ssh-reconnect-tokens.test.tssrc/renderer/src/hooks/direct-ssh-reconnect-tokens.tssrc/renderer/src/hooks/direct-ssh-runtime-wake-isolation.test.tsxsrc/renderer/src/hooks/direct-ssh-state-routing.test.tssrc/renderer/src/hooks/direct-ssh-state-routing.tssrc/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-cancellation.tssrc/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-metrics.tssrc/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-types.tssrc/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler.test.tssrc/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler.tssrc/renderer/src/hooks/direct-ssh-worktree-refresh-target-queue.tssrc/renderer/src/hooks/ipc-events-ssh-authority-test-fixtures.tssrc/renderer/src/hooks/ipc-events/app-lifetime-ipc-bridge.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-hydration-fanout.test.tssrc/renderer/src/hooks/ipc-events/direct-ssh-hydration-target-metadata.test.tssrc/renderer/src/hooks/ipc-events/direct-ssh-initial-state-hydration.tssrc/renderer/src/hooks/ipc-events/direct-ssh-state-ipc-bridge.tssrc/renderer/src/hooks/useIpcEvents-agent-status-ssh-authority.test.tssrc/renderer/src/lib/direct-ssh-reconnect-product-telemetry-types.tssrc/renderer/src/lib/direct-ssh-reconnect-product-telemetry.test.tssrc/renderer/src/lib/direct-ssh-reconnect-product-telemetry.tssrc/renderer/src/store/slices/store-session-terminal-reconnect.test.tssrc/renderer/src/store/slices/store-session-workspace-hydration.test.tssrc/renderer/src/store/slices/terminal-session-row-hydration.tssrc/renderer/src/store/slices/terminals-hydration-canonical-pty-overlap.test.tssrc/renderer/src/store/slices/terminals-hydration.test.tssrc/renderer/src/store/slices/worktrees-fetch-persisted-metadata-fallback.test.tssrc/renderer/src/store/slices/worktrees-fetch-refresh-coalescing.test.tssrc/renderer/src/store/slices/worktrees-fetch-stale-catalog-version.test.tssrc/renderer/src/store/slices/worktrees.tssrc/renderer/src/store/slices/worktrees/listing/known-ssh-worktree-fetch.tssrc/renderer/src/store/terminals/direct-ssh-terminal-bindings.tssrc/renderer/src/store/terminals/terminal-actions.tssrc/renderer/src/store/terminals/terminal-contracts.tssrc/renderer/src/store/terminals/terminal-pty-identities.tssrc/renderer/src/store/terminals/workspace-terminal-hydration-patch.tssrc/renderer/src/store/terminals/workspace-terminal-hydration.tssrc/renderer/src/store/terminals/workspace-terminal-reconnect.tssrc/renderer/src/store/terminals/workspace-terminal-row-plan.tssrc/shared/direct-ssh-reconnect-telemetry-schema.test.tssrc/shared/host-lineage-contract.tssrc/shared/host-repo-catalog-contract.tssrc/shared/telemetry-event-registry.tssrc/shared/telemetry-feature-education-event-schemas.ts
💤 Files with no reviewable changes (58)
- src/main/ipc/worktree-create-lineage.test.ts
- src/renderer/src/hooks/direct-ssh-reconnect-coordinator.test.ts
- src/shared/telemetry-event-registry.ts
- src/renderer/src/store/slices/terminals-hydration.test.ts
- src/main/ipc/worktrees/metadata/workspace-lineage-candidate-scan.test.ts
- src/renderer/src/hooks/direct-ssh-reconnect-rollout.test.ts
- src/preload/api/repository-api.ts
- src/shared/host-repo-catalog-contract.ts
- src/renderer/src/hooks/direct-ssh-worktree-refresh-target-queue.ts
- src/preload/api/worktree-api.ts
- src/preload/api/worktrees-bridge.ts
- src/main/ipc/worktrees.ts
- src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-cancellation.ts
- src/renderer/src/hooks/direct-ssh-reconnect-rollout.ts
- src/shared/direct-ssh-reconnect-telemetry-schema.test.ts
- src/renderer/src/hooks/ipc-events/direct-ssh-bridge-runtime.ts
- src/renderer/src/hooks/direct-ssh-host-hydration-scope.ts
- src/renderer/src/lib/direct-ssh-reconnect-product-telemetry-types.ts
- src/main/ipc/worktrees-create-metadata-persistence.test.ts
- src/renderer/src/hooks/direct-ssh-reconnect-coordinator-telemetry.ts
- src/renderer/src/hooks/direct-ssh-host-hydration.test.ts
- src/preload/api/repos-bridge.ts
- src/main/ipc/repos.ts
- src/main/ipc/worktrees/listing/detected-provider-listing.ts
- src/renderer/src/hooks/direct-ssh-reconnect-coordinator-types.ts
- src/renderer/src/store/slices/worktrees.ts
- src/renderer/src/hooks/direct-ssh-host-catalog-noop.test.ts
- src/shared/telemetry-feature-education-event-schemas.ts
- src/renderer/src/store/slices/terminals-hydration-canonical-pty-overlap.test.ts
- src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.test.ts
- src/renderer/src/store/terminals/terminal-pty-identities.ts
- src/renderer/src/hooks/direct-ssh-reconnect-preparation-metrics.ts
- src/main/ipc/repos/repo-catalog-handlers.ts
- src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler.test.ts
- src/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.ts
- src/renderer/src/hooks/direct-ssh-reconnect-tokens.ts
- src/main/ipc/repos/host-repo-catalog-snapshot.ts
- src/main/ipc/worktrees/metadata/workspace-lineage-filtering.ts
- src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.ts
- src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-types.ts
- src/renderer/src/hooks/direct-ssh-reconnect-preparation.ts
- src/renderer/src/hooks/direct-ssh-reconnect-coordinator-outcomes.ts
- src/renderer/src/hooks/direct-ssh-reconnect-tokens.test.ts
- src/main/ipc/worktrees/metadata/host-lineage-listing.ts
- src/renderer/src/store/terminals/workspace-terminal-hydration-patch.ts
- src/renderer/src/hooks/direct-ssh-reconnect-coordinator.ts
- src/shared/host-lineage-contract.ts
- src/renderer/src/store/slices/store-session-terminal-reconnect.test.ts
- src/renderer/src/hooks/direct-ssh-host-hydration-telemetry.ts
- src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-metrics.ts
- src/renderer/src/hooks/direct-ssh-reconnect-coordinator-stabilization.ts
- src/renderer/src/hooks/direct-ssh-host-hydration.ts
- src/renderer/src/store/terminals/terminal-contracts.ts
- src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler.ts
- src/main/ssh/orcad-retained-source-lists.test.ts
- src/main/ipc/worktrees/metadata/lineage-owner-resolution.ts
- config/scripts/ci-shard-timings.json
- src/renderer/src/hooks/direct-ssh-state-routing.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.
| "direct SSH generation-scope rollover" | ||
| ], | ||
| "platforms": ["macos", "linux", "windows"], | ||
| "providers": ["local", "ssh"], | ||
| "coveredPlatforms": ["macos"], | ||
| "coveredProviders": ["local", "ssh"], | ||
| "coverageNotes": "Local deterministic evidence covers git-common classification, desktop watcher debounce counts, non-overlapping poller semantics, macOS native-watch fallback, preload cleanup, Source Control active-visible repo filtering, paired-runtime publication to two independent clients with reconnect and stale-cache checks, the direct SSH five-slot fair scheduler, timeout barrier, aggregate privacy schema, coordinator-to-renderer telemetry wiring, host-catalog provenance rejection, and process generation-scope rollover across sibling targets. A headed macOS Electron host and separate paired Electron client both rendered a worktree created through the real Git binary and watcher entry path without reconnect. A macOS Electron client also completed a direct SSH disconnect/reconnect against an ephemeral Linux Docker target with exact host/authority hydration and remote proof-file verification. Linux/Windows desktop clients, multi-target live fanout, and WSL runs remain gaps.", | ||
| "coverageNotes": "Local deterministic evidence covers git-common classification, desktop watcher debounce counts, non-overlapping poller semantics, macOS native-watch fallback, preload cleanup, Source Control active-visible repo filtering, paired-runtime publication to two independent clients with reconnect and stale-cache checks, and process generation-scope rollover across sibling targets. A headed macOS Electron host and separate paired Electron client both rendered a worktree created through the real Git binary and watcher entry path without reconnect. Linux/Windows desktop clients, multi-target live fanout, and WSL runs remain gaps.", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n -i 'scheduler|coordinator|telemetry' config/reliability-gates.jsonc | sed -n '1,80p'Repository: stablyai/orca
Length of output: 44732
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- current gate block ---'
nl -ba config/reliability-gates.jsonc | sed -n '4258,4480p'
printf '%s\n' '--- sibling ssh-terminal block ---'
nl -ba config/reliability-gates.jsonc | sed -n '13318,13338p'
printf '%s\n' '--- diff for cited ranges ---'
git diff --unified=5 f0b310b1b134aae807bbcf5631be1b0e19a40c15 defa9eef614827254a0c813d4641d8f6c6e6696 -- config/reliability-gates.jsonc | sed -n '/git-worktree.refresh-event-semantics/,/^[^ ]/p'Repository: stablyai/orca
Length of output: 26030
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- base cited blocks ---'
git show f0b310b1b134aae807bbcf5631be1b0e19a40c15:config/reliability-gates.jsonc | nl -ba | sed -n '4258,4485p'
git show f0b310b1b134aae807bbcf5631be1b0e19a40c15:config/reliability-gates.jsonc | nl -ba | sed -n '13318,13338p'
printf '%s\n' '--- exact diff hunks ---'
git diff --unified=8 f0b310b1b134aae807bbcf5631be1b0e19a40c15 defa9eef614827254a0c813d4641d8f6c6e6696c -- config/reliability-gates.jsonc | rg -n -C 12 'git-worktree.refresh-event-semantics|direct SSH scheduler|detected-worktree|scheduler caps|telemetry'
printf '%s\n' '--- current source references ---'
rg -n -i 'detected-worktree|scheduler caps|late-work allowance|unsettled.*work' src config --glob '!config/reliability-gates.jsonc' || test "$?" -eq 1Repository: stablyai/orca
Length of output: 41662
Remove the remaining direct-SSH scheduler and telemetry references.
coverageNotes, invariant, and oracle already reflect the narrowed coverage. The stale references remain in runtimeBudget.scope, flakeHistory.evidence, and the sibling ssh-terminal performance budget.
Suggested fix
- "scope": "focused main/preload/renderer polling and direct SSH scheduler/telemetry tests"
+ "scope": "focused main/preload/renderer polling and direct SSH state-bridge tests"- "evidence": "Four focused deterministic local macOS runs cover the original watcher lane, paired-runtime publication lane, main catalog/authority lane, and direct SSH scheduler/telemetry lane; two live Electron runs cover paired external discovery and Docker SSH, while CI soak is still unavailable."
+ "evidence": "Four focused deterministic local macOS runs cover the original watcher lane, paired-runtime publication lane, main catalog/authority lane, and direct SSH state-bridge lane; two live Electron runs cover paired external discovery and Docker SSH, while CI soak is still unavailable."- "evidence": "Direct SSH terminal invalidation and retry each use one exact-target store publication and execute before provider discovery; another target's five occupied provider slots cannot delay terminal finalization. Each split-pane completion or delayed mount adds constant-time pending/live lease lookups and no provider listing, polling, subprocess, cross-tab scan, or new fanout; two mounted leaves still perform exactly their two existing provider operations. Delayed snapshot placement retains at most one 10-second store subscription and timer per target; supersession and stop abort both immediately, remove the listener, and clear the timer. The scheduler caps locally unsettled detected-worktree work at five with a two-call late-work allowance. Remote-runtime recovery allocates at most one backoff timer and one one-minute deadline per detached pane, then stops all PTY retry work until explicit user action. Each transport suppresses at most eight distinct error strings and emits at most eight clear callbacks on recovery; each live pane retains at most eight messages, and every message and joined display is clipped to 24 lines and 4,000 characters. Explicit split close and pane replacement release their entries. This adds no provider request, polling, subprocess, or terminal-output work. Timers, accepted-snapshot listeners, stale streams, and pane UI entries are released on health, cutoff, rebind, removal, detach, or destroy; ten-cycle tests prove one unsubscribe per epoch. Common terminal input/output paths add only bounded state checks. No live large-terminal-map direct SSH timing is claimed."
+ "evidence": "Direct SSH terminal invalidation and retry each use one exact-target store publication and execute before provider discovery; another target's five occupied provider slots cannot delay terminal finalization. Each split-pane completion or delayed mount adds constant-time pending/live lease lookups and no provider listing, polling, subprocess, cross-tab scan, or new fanout; two mounted leaves still perform exactly their two existing provider operations. Delayed snapshot placement retains at most one 10-second store subscription and timer per target; supersession and stop abort both immediately, remove the listener, and clear the timer. Remote-runtime recovery allocates at most one backoff timer and one one-minute deadline per detached pane, then stops all PTY retry work until explicit user action. Each transport suppresses at most eight distinct error strings and emits at most eight clear callbacks on recovery; each live pane retains at most eight messages, and every message and joined display is clipped to 24 lines and 4,000 characters. Explicit split close and pane replacement release their entries. This adds no provider request, polling, subprocess, or terminal-output work. Timers, accepted-snapshot listeners, stale streams, and pane UI entries are released on health, cutoff, rebind, removal, detach, or destroy; ten-cycle tests prove one unsubscribe per epoch. Common terminal input/output paths add only bounded state checks. No live large-terminal-map direct SSH timing is claimed."…rdinator No ssh: git provider is registered in production, so the reconnect coordinator's catalog and lineage reads always came back non-authoritative and its worktree refresh never merged. Its only live effect was clearing an unconverted target's stale PTY bindings on each connected push and on wake; the state bridge now does that directly. Deletes the coordinator, preparation, worktree refresh scheduler, host hydration, rollout flag and their product telemetry event, the scoped direct-SSH reconnect/hydration options, and the now caller-less repos:listForExecutionHost and worktrees:listLineageForHost IPC handlers. Co-authored-by: m4air <[email protected]>
defa9ee to
3ece529
Compare
ELI5
When an old-style SSH target (one not yet moved onto the managed Orca server) connects, the app used to run a large "reconnect coordinator". It asked the main process for that host's projects, worktrees and parent/child links, queued the work five at a time, retried timeouts and sent an analytics event. The main process can no longer answer those questions for an
ssh:host, because the old relay that served them was deleted. So every one of those reads came back "not available", and nothing was ever applied. This PR deletes that machinery. The one thing it still did, forgetting stale terminal bindings for that target, is now done directly.What Changed
What you see: nothing changes. Connecting, disconnecting, waking the computer and going back online all behave as before. Port forwards, credential prompts and the connection-state hydration are untouched.
Mechanism:
hooks/direct-ssh-reconnect-*,hooks/direct-ssh-worktree-refresh-*,hooks/direct-ssh-host-hydration*,lib/direct-ssh-reconnect-product-telemetry*,hooks/ipc-events/direct-ssh-bridge-runtime.ts).direct-ssh-state-ipc-bridge.tsno longer takes a runtime object. On every pushed connected state it callsclearDirectSshTargetPtyBindings(targetId), and the online/system-resume wake does the same for each connected target. This is exactly when the old code cleared them: changed authority, same-authority push and wake all cleared, and initial hydration did not.invalidateStaleDirectSshTargetPtyBindingsis gone. Its authority check always passed at these call sites, because they read the authority from the store in the same tick.reconnectPersistedTerminals(signal, options),HydrateWorkspaceSessionOptions.directSshAuthorityandrowsFromRemoteSnapshot. Production callers never passed them.acquireDirectSshDetectedWorktreeRefresh(coordinator-only).repos:listForExecutionHostandworktrees:listLineageForHostIPC handlers had no callers left, so they are deleted along with their preload entries, shared contracts and the main-side lineage-for-host filter (host-repo-catalog-snapshot.ts,host-lineage-listing.ts,workspace-lineage-filtering.ts,lineage-owner-resolution.ts).direct_ssh_reconnect_operationtelemetry schema.Kept: the host still publishes
providerEpochandconnectionGeneration, because mobile readsconnectionGeneration. The renderer still reconciles a partial pushed authority, because the worktree listing uses it. The disconnect clear and target-scope resolution are unchanged.Net lines: prod −3,306, tests −3,515, config −62 (about −6.9k total).
Why
Proof that the deleted code never had an effect:
registerSshGitProvider, solistReposForExecutionHostreturnedunavailableorstalefor everyssh:host.listDesktopLineageForHostalways returned non-authoritative forssh:. Both catalog merges were unreachable.authorityRequirement: 'required', and main answers anssh:git repo listing withnon-authoritative, so that merge returned early. One exception: a folder project on anssh:target is listed from local metadata and comes backcomplete. The coordinator could therefore re-merge those folder rows on connect. Two things make that redundant. The ordinaryfetchAllWorktreespath produces the same authoritative merge for a connected target. And a connectedssh:target is always a managed server (plain-SSH mode has no writer), whose conversion removes the source rows.ssh:PTY between the two clears, so dropping it changes nothing.Alternatives I rejected:
ssh:PTY ids on inert tabs. That is a behaviour change, so it is out of scope.The only observable difference is that the
direct_ssh_reconnect_operationanalytics event is no longer sent. It described work that could not succeed.Linked Issue
Phase 3.99 cleanup, item C2b (follows #27489 and #27569).
Visual Proof
N/A: no UI or interaction change. The deleted code produced no visible state.
Testing
I manually tested these changes locally (focused suites only; no app launch)
Automated tests added/updated, or explained why not below
pnpm tcclean.pnpm lintpasses, and the ratchets are at or below baseline: ts-nocheck 159, focus-read 1138, layout writers unchanged.check:code-quality:changedreports 0 findings.Dead-code proof:
rgfor every removed symbol and module path oversrc config scripts mobile packages tests .github docsreturns only the edits in this PR. A word-matchrgover all 159@ts-nocheckfiles returns 0 hits.build:electron-viteandbuild:cliboth pass.Tests:
vitestoversrc/renderer/src/{store,hooks,app-shell,startup},src/main/{ipc,ssh},src/preloadandsrc/sharedpasses (1,382 + 1,114 files).Rewritten tests:
direct-ssh-connect-reply-routing.test.tsasserts when the target clear runs.useIpcEvents-agent-status-ssh-authority.test.tsasserts that a reconciled partial authority clears once and a conflicting one does not.Reliability gates were updated: deleted suites removed, and evidence was re-run for the narrowed command.
AI Disclosure
Review
Agent skill upstream boundary
Notes
connectionGeneration, which is unchanged.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)