Conversation
The symlink to the agent socket is created conditionally, but the export ran unconditionally. With setup_ssh disabled -- or simply with no agent running -- every shell got SSH_AUTH_SOCK pointing at a non-existent ~/.ssh/ssh_auth_sock, which breaks agent forwarding that would otherwise have worked. Guard the export with -S (which follows the symlink, so a dangling link is correctly rejected), and mkdir ~/.ssh before linking into it so the ln does not error on hosts where setup_ssh never ran. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, locally contained to shell init logic, and corrects a concrete failure mode without introducing new behavioral risk.
Pull request overview
This PR fixes an SSH agent environment propagation issue in prestobuntu.zsh by ensuring SSH_AUTH_SOCK is only pointed at the stable ~/.ssh/ssh_auth_sock path when that path actually resolves to a live socket, avoiding broken agent forwarding in shells where no agent is running.
Changes:
- Create
~/.sshbefore attempting to symlink the agent socket into it. - Guard the
SSH_AUTH_SOCKexport behind a[[ -S ... ]]check so a dangling symlink is not exported. - Add inline commentary explaining the rationale and behavior (including symlink-following semantics).
File summaries
| File | Description |
|---|---|
prestobuntu.zsh |
Prevents exporting a non-existent SSH_AUTH_SOCK by exporting only when the stable symlink resolves to a live socket; also ensures ~/.ssh exists before linking. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
The symlink to the agent socket is created conditionally, but the
export ran unconditionally. With setup_ssh disabled -- or simply with
no agent running -- every shell got SSH_AUTH_SOCK pointing at a
non-existent ~/.ssh/ssh_auth_sock, which breaks agent forwarding that
would otherwise have worked.
Guard the export with -S (which follows the symlink, so a dangling
link is correctly rejected), and mkdir ~/.ssh before linking into it
so the ln does not error on hosts where setup_ssh never ran.
🤖 Generated with Claude Code