(remote): bind watch-channel handlers to their child, add ssh keepalive and failure logs - #258
Merged
Merged
Conversation
…ve and failure logs stop() then start() raced the previous child's asynchronous close: its handler, bound to the per-host state, dropped the new child and scheduled a third, leaving an unkillable ssh per host on every manual refresh or host toggle. Handlers now check the child's identity. The watch ssh gets ConnectTimeout and ServerAlive so a half-open session dies instead of staying "running", quick failures log their stderr tail once per backoff tier, and stop() clears pending coalesce timers.
Merged
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.
Audit 2026-09-11, findings 1, 4 and 11 (
.work-files/switchboard/audit-fable-2026-09-11.md, local note).Why
stop()followed bystart()on the same host raced the previous child's asynchronousclose: its handler was bound to the per-host state, so when it fired it dropped the new child from the state and scheduled a third one. Result: an unkillablessh -tt … inotifywaitper host on every manual refresh, per-host reconnect, or host toggle in Settings (the toggle path ships in v0.0.75). Reproduced with a fake child whoseclosearrives one tick late: 2 children alive after stop+start, 3 spawned after the restart timer, 1 survivor afterstopAll().What
data,stderr,close) checkss.child === childbefore touching the state; a superseded child's late close or chunk is ignored.ConnectTimeout=10,ServerAliveInterval=30,ServerAliveCountMax=3, so a half-open session dies and gets restarted instead of staying "running" forever.main.log.stop()clears pending coalesce timers soonEventcannot fire after stop.closeasynchronously, like a realChildProcess.Proof
Mutations: remove the identity guard in
onExit→ the F1 race test and the F4 duplicate-close test go red; drop the stderr capture → the warn-content test red.task check: 1256 pass, 0 fail, 8 pre-existing skips.