fix(desktop): finish POSIX SSH spawn publication - #96103
Closed
Wenfengcheng wants to merge 1 commit into
Closed
Conversation
4 tasks
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.
Summary
Follow-up to #96084, targeting its
salv/96061-spawn-fixesbranch rather thanmainso @SmelterLabs' salvaged commit and authorship remain intact.This closes three remaining gaps in the same managed-SSH spawn path:
setsidwrapper PID with the backend PID;sed .../g.Related issue: #96024. This PR deliberately does not duplicate #96084's ownership-variable or stale-reaper changes.
Root Cause
expandRemotePath()returns a complete shell word.withRemoteUpdateMutex()still wrapped that word inshq(), so Python could receive literal quote characters instead of the expanded mutex path.The detached launch also emitted
$!twice: the outersetsid ... & echo $!reported a wrapper that had already exited, while the inner shell reported the live backend. In 20/20 WSL probes,childcontained both PID lines. That breaks signal handling and lockfile publication.Finally, #96084's POSIX replacement used first-match
sed. Because lock metadata precedes the finalpidfield, an earlier__PID__occurrence could be replaced while leavingpid: "__PID__"./gpreserves the previous Bash global-replacement behavior.Fix
shq(mutexPath);& echo $!, retaining the inner backendecho $!,setsid/nohup, redirections, and mutex-FD close;gflag to PID substitution;How to Verify
cd apps/desktop npx vitest run --config vitest.config.ts electron/remote-lifecycle.test.ts npm run typecheck npx eslint electron/remote-lifecycle.ts electron/remote-lifecycle.test.tsThe three focused tests failed against parent
542736a891and pass at994746f5d2.Test Plan
remote-lifecycle.test.ts: 91 passed, 3 platform-skippedgit diff --checkand static secret/debug/conflict scan passed/bin/sh(dash) full ownership payload passed:FULL_PIDFULL_LOCK_PIDmatched itserve --isolatedargv$HOMEpathPlatforms tested: Windows 11/Git Bash and WSL2 Ubuntu/dash. I did not independently repeat #96084's external macOS-to-Ubuntu SSH round trip.
Risk Assessment
Medium-low — this touches process lifecycle and shell construction, but the production diff is three narrow lines. Mutex/flock ownership, descriptor closure, reservation protocol, atomic lock publication, token handling, authentication, timeout, and stale-reaper behavior are unchanged.