fix(desktop): backfill SSH_AUTH_SOCK from login shell on macOS#972
fix(desktop): backfill SSH_AUTH_SOCK from login shell on macOS#972stickerdaniel wants to merge 2 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR extends the shared “read env from login shell” utility so the macOS desktop app can hydrate more than just PATH at startup, specifically backfilling SSH_AUTH_SOCK when it’s missing (e.g., Finder/Dock launches) while preserving inherited values when present.
Changes:
- Replaced the desktop-only
fixPath()hook withsyncShellEnvironment()and wired it into desktop startup. - Generalized the shared login-shell probe to support reading multiple environment variables (used for
PATH+SSH_AUTH_SOCK). - Added unit tests for the shared shell helper and for desktop macOS/no-op/regression behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/shell.ts | Adds multi-variable login-shell environment capture/extraction and reimplements readPathFromLoginShell on top of it. |
| packages/shared/src/shell.test.ts | Updates PATH probe test markers and adds tests for multi-variable extraction behavior. |
| apps/desktop/src/syncShellEnvironment.ts | New macOS-only startup hook to sync PATH and backfill missing SSH_AUTH_SOCK. |
| apps/desktop/src/syncShellEnvironment.test.ts | Adds tests for macOS hydration, preservation of inherited SSH_AUTH_SOCK, omission behavior, and non-macOS no-op. |
| apps/desktop/src/main.ts | Switches startup hook from fixPath() to syncShellEnvironment(). |
| apps/desktop/src/fixPath.ts | Removes the previous desktop-only PATH fix implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes #971.
What Changed
fixPath()startup hook withsyncShellEnvironment()PATHPATHon macOS startup, but only backfillSSH_AUTH_SOCKwhen it is missingSSH_AUTH_SOCKmust be preservedWhy
The macOS desktop app currently repairs
PATHfrom the login shell, but Finder and Dock launches can still missSSH_AUTH_SOCK. That breaks Git-over-SSH flows in the desktop app even when the same repo works correctly from Terminal.This keeps the fix small and reliability-focused:
SSH_AUTH_SOCKinstead of being overwritten by a different login-shell valueUI Changes
None.
Checklist
Note
Backfill
SSH_AUTH_SOCKfrom login shell environment on macOS desktop app startupfixPath()with a newsyncShellEnvironment()utility in syncShellEnvironment.ts that reads bothPATHandSSH_AUTH_SOCKfrom the user's login shell on macOS.SSH_AUTH_SOCKis only set if not already present in the environment;PATHis always overwritten with the shell value if available.readEnvironmentFromLoginShellhelper in shell.ts that captures multiple env vars in a single shell invocation using per-variable start/end markers.readPathFromLoginShellnow delegates toreadEnvironmentFromLoginShelland no longer fails whenprintenv PATHexits non-zero.SSH_AUTH_SOCKat startup if the login shell has it set and the process does not.Macroscope summarized a717465.