Repository navigation
fix(ssh): flag a macOS host whose managed server outlived its launching SSH session - #29371
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
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:
6cc03037-7cd7-4571-9e3b-5d03e37a4171
📒 Files selected for processing: 22
docs/site/content/docs/ssh.mdxsrc/main/ipc/managed-orcad-actions.tssrc/main/ipc/orcad-runtime-maintenance-handlers.tssrc/main/ipc/runtime-environment-handler-channels.tssrc/main/ipc/runtime-environment-managed-tunnel.tssrc/main/ipc/ssh-connect-flow.tssrc/main/ipc/ssh-host-launch-session-note.tssrc/main/ssh/orcad-launch-ssh-session.test.tssrc/main/ssh/orcad-launch-ssh-session.tssrc/main/ssh/orcad-managed-launch-session.test.tssrc/main/ssh/orcad-managed-launch-session.tssrc/main/ssh/orcad-remote-launch.tssrc/preload/api/managed-orcad-api.tssrc/renderer/src/components/settings/SshHostDeltaMoveDialog.test.tsxsrc/renderer/src/components/settings/SshHostRestartServerAction.test.tsxsrc/renderer/src/components/settings/SshHostRestartServerAction.tsxsrc/renderer/src/components/settings/SshTargetServerStatus.tsxsrc/renderer/src/ssh/ssh-host-launch-session-copy.tssrc/renderer/src/ssh/ssh-host-server-status-copy.test.tssrc/renderer/src/ssh/ssh-host-server-status-copy.tssrc/shared/orcad-managed-runtime.tssrc/shared/ssh-types.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
| return translate( | ||
| 'auto.components.settings.restartServer.terminalsRunning', | ||
| '{{count}} terminals are still running on this host. Close them, then restart the managed server.', | ||
| { count: result.liveSessions } | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
The message says "1 terminals" when the count is 1.
The message text has no plural form. If liveSessions is 1, the UI shows "1 terminals are still running". Add i18next plural keys (_one/_other) or use wording that works for any count.
…ng SSH session macOS Local Network privacy pins a nohup-launched orcad to the sshd-session that started it; once that session ends, its terminals lose LAN access (#25934). A macOS launch now records that session, a connect reports it when it proved exited, and the host status offers a restart when no terminals are running.
…estart that can't hold its session
…survives; never redial for the check
…e English catalog
05a7cb8 to
1aae3dd
Compare
ELI5
On a Mac that you reach over SSH, macOS decides which programs may talk to devices on the local network by looking at "who started this". For Orca's managed server, the answer is the SSH session that launched it. When that SSH session closes, macOS can no longer check it, and programs in Orca's terminals on that Mac (kubectl, Homebrew node and python,
.localnames) start failing with "no route to host". This PR does not prevent that. It notices when it has happened, tells you, and offers a one-click restart that starts the server again from your current connection.What Changed
Mechanism:
orcadLaunchCommand(macOSnohuplaunches only) walks the launching shell's parents withps -o ppid=/ps -o comm=to the nearestsshd*process. It writes<orcad pid> <sshd pid> <sshd start time>to.orcad-launch-ssh-sessionin the slot dir after$!is recorded. Linux, WSL (setsid) and Windows launch commands are byte-for-byte unchanged.live,exitedorunverifiable, plusnot-recordedandnot-applicable. The warning appears only onexited: the sshd pid is gone, or the pid now has a different start time because it was reused. Apsthat can't answer givesunverifiable, and no warning shows. Hosts below macOS 15, and launches with no record or a record whose orcad pid doesn't match.orcad-pid(an older client launched it), show nothing.runtimeEnvironments:restartOrcad) runs in the target's lifecycle queue. It reads the terminal census and refuses unlessliveSessions === 0. It then stops the active slot under the activation fence through the rollback's managed stop with idle-daemon retirement (orcad closes terminal admission and retires the daemon only when no session exists), starts it again with the existing wake, and rebuilds the tunnel in case the port moved. If the daemon wasn't retired, the server is still started again, but the result says so and the warning stays.docs/site/content/docs/ssh.mdxcovers what happens and the admin workaround: thecom.apple.network.local-networkAllowedEthernetLocalNetworkAddresses/AllowedWiFiLocalNetworkAddressesdefaults, macOS 15.5+, sudo, then restart.Why
No launch mode keeps both Full Disk Access (granted to remote users through sshd) and Local Network access for a process that outlives its SSH session (Apple TN3179; https://developer.apple.com/forums/thread/811712). So we keep
nohupand add detection and recovery instead of changing how the server is launched.Linked Issue
Refs #25934. This is the short-term mitigation; the underlying macOS attribution is unchanged, so the issue stays open.
Visual Proof
N/A for a live capture. The warning appears only on a macOS 15+ SSH host whose launching session ended, which can't be reproduced on a CI or local display. The line and dialog use the existing status-line tone and
Dialog/Buttonprimitives, the same as "Move anyway…". Component tests cover their rendering and outcomes.Testing
src/main/ssh/orcad-launch-ssh-session.test.ts: runs the real generated shell through/bin/shagainst a fakepstable andsw_vers. It covers the ancestor walk (nearest sshd, no session outside SSH), the record written by the full macOS launch command (which still prints the runtime PID last), stale-record removal, exited, PID reuse, unverifiableps, older-client and missing records, below macOS 15 and off macOS, and that Linux andsetsidlaunches carry nothing.src/main/ssh/orcad-managed-launch-session.test.ts: restart never stops a server while terminals run or are uncounted, stops then wakes then rebuilds when there are none, and leaves an unconfirmed stop running. The probe runs nothing on Linux.SshHostRestartServerAction.test.tsxandssh-host-server-status-copy.test.ts: the warning line, the confirmation, and each refusal message.pnpm tc,pnpm run check:code-quality:changed, and existing launch/shell integration tests pass.Not yet verified on a real macOS 27 SSH host (see Notes).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Still needs a real macOS 27 SSH host:
ps -o comm=names the sessionsshd-sessionand that the nearest one exits when the connection closes, including with ControlMaster multiplexing.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)