Repository navigation
fix(ssh): re-arm remote watches that die without a reconnect - #10456
Merged
brennanb2025 merged 5 commits intoJul 25, 2026
Conversation
The 60s fast-retry window gave up with a single overflow and no further trigger — provider registration is the only re-arm, and a watch killed by remote OOM/inotify exhaustion leaves the SSH link perfectly healthy. Back off from 1min to a 30min ceiling instead, and stand down entirely when the provider is gone so registration owns that case.
SshFilesystemProvider.dispose() stops each watch registration without invoking its terminal callbacks, so a dropped transport left the runtime file-explorer watch silently dead: the lease's restart only runs from the failed-removal path, and the renderer's runtime subscription stays open because it rides a different link. Reinstall on the connection's next provider registration and emit overflow so clients resync.
…followup-watch-death-no-reconnect
…ver-ssh-until-the-file' of https://github.com/stablyai/orca into brennanb2025/sta2525-followup-watch-death-no-reconnect
…ver-ssh-until-the-file' of https://github.com/stablyai/orca into brennanb2025/sta2525-followup-watch-death-no-reconnect
brennanb2025
merged commit Jul 25, 2026
3951672
into
brennan/sta-2525-remote-file-changes-are-not-detected-over-ssh-until-the-file
1 check passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #10445 — review that first; the base branch here is
brennan/sta-2525-remote-file-changes-are-not-detected-over-ssh-until-the-file.#10445 re-arms remote file watches when the SSH provider re-registers, which covers a reconnect and a first connect slower than the 60s give-up. Provider registration is the only re-arm trigger it adds, and that leaves two holes this PR closes. Both were confirmed by a failing test before either fix was written.
Gap 1 — a watch that dies without a reconnect (
77c2b9a306)Remote OOM, inotify/fd exhaustion, or the relay watcher being killed all leave the SSH link perfectly healthy, so no registration ever follows. The watch went
handleRemoteWatcherTerminalError→ 1s retries → capped atREMOTE_WATCH_RETRY_TIMEOUT_MS(60s) → one give-upoverflow→ dead until the app restarts. Thatoverflowrefreshes the tab once and then the tab silently stops updating — the original STA-2525 symptom.After the fast window gives up, the key now arms a bounded backoff off the existing
desiredRemoteWatchersintent: 60s doubling to a 30-minute ceiling. A permanently broken remote costs roughly 5fs.watchcalls in the first half hour instead of 60 in the first minute.It stands down rather than competing when something else owns recovery: a live
remoteWatchersentry, an in-flight fast retry, an empty listener set, a deliberate removal, or no SSH provider at all — the last one hands the reconnect case back to #10445's registration hook instead of adding wire traffic to a link already being rebuilt. The timer isunref()'d so a half-hour timer never holds the process alive at quit.Gap 2 — the file-explorer watch never recovered either (
fd55ed997f)SshFilesystemProvider.dispose()callsstopSshFilesystemWatchRegistration, which — unlikefailSshFilesystemWatchRegistration— never invokesterminalCallbacks. So a transport drop fires no terminal callback for the file-explorer lease.The renderer does not rescue it:
useFileExplorerWatch/useEditorExternalWatchonly take the runtime path whenruntimeEnvironmentIdis set,failSharedRuntimeFileWatchmerely deletes the shared watch, and bothonErrorhandlers onlyconsole.warn. The file tree therefore stayed stale across a reconnect even with #10445.Fixed entirely in the main process by reinstalling on the connection's next provider registration and emitting
overflow. No renderer change was needed.Testing
8 new tests across two sibling files (
filesystem-watcher-dormant-rearm.test.ts,orca-runtime-files-ssh-rearm.test.ts— sibling files becausefilesystem-watcher.test.tsis at the 800-line lint cap andmax-linesdisables are forbidden). Every one proven non-vacuous by mutating the source and watching it fail.Gates: 132/132 across the touched test files,
tsc --noEmitclean,oxlintclean.Not verified
No real SSH host — Gap 1 in particular is verified by code trace and mocked-provider tests, not by inducing a real remote inotify exhaustion. No Windows/WSL run.
Note
CI
verifyis currently red repo-wide, not from this PR:.github/workflows/release-cut.ymlreintroducedgenerate-skill-bundle-manifestinto its bump step in #10340, whichpackage-electron-runtime-contract.test.mjsexplicitly forbids. It fails identically on pristinemain.