Repository navigation
fix: omit SSH_AUTH_SOCK from forward.env when symlinking - #453
Open
RobinLassonde wants to merge 1 commit into
Open
RobinLassonde wants to merge 1 commit into
RobinLassonde wants to merge 1 commit into
Conversation
When SSH_AUTH_SOCK symlinking is active (the default), build_shell_env initializes SSH_AUTH_SOCK to the stable per-session symlink ($SHPOOL_SESSION_DIR/ssh-auth-sock.socket) and link_ssh_auth_sock updates that symlink on every attach. However, populate_session_env_file was also writing the client's raw SSH_AUTH_SOCK path from header.local_env into forward.env. On the next prompt cycle, the shell's prompt hook sourced forward.env and overwrote SSH_AUTH_SOCK with the ephemeral client socket path. After disconnecting and reattaching with a new agent socket, the first command run before a subsequent prompt cycle saw the stale socket path instead of the updated symlink. Skip SSH_AUTH_SOCK in format_forward_env when nosymlink_ssh_auth_sock is false/unset so forward.env leaves the per-session symlink untouched, while preserving existing behavior when nosymlink_ssh_auth_sock = true. Add a unit test for format_forward_env filtering and an integration test verifying SSH_AUTH_SOCK resolves to the updated symlink target on the first command after reattach. AI usage: used AI to generate the entire PR, including tests.
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.
Issue Link
N/A
AI Policy Ack
Please ack that you have read the AI Policy
and explain your use of AI to generate this PR.
This PR was:
Description
When SSH_AUTH_SOCK symlinking is active (the default), build_shell_env initializes SSH_AUTH_SOCK to the stable per-session symlink ($SHPOOL_SESSION_DIR/ssh-auth-sock.socket) and link_ssh_auth_sock updates that symlink on every attach.
However, populate_session_env_file was also writing the client's raw SSH_AUTH_SOCK path from header.local_env into forward.env. On the next prompt cycle, the shell's prompt hook sourced forward.env and overwrote SSH_AUTH_SOCK with the ephemeral client socket path. After disconnecting and reattaching with a new agent socket, the first command run before a subsequent prompt cycle saw the stale socket path instead of the updated symlink.
Skip SSH_AUTH_SOCK in format_forward_env when
nosymlink_ssh_auth_sock is false/unset so forward.env leaves the per-session symlink untouched, while preserving existing behavior when nosymlink_ssh_auth_sock = true.
Add a unit test for format_forward_env filtering and an integration test verifying SSH_AUTH_SOCK resolves to the updated symlink target on the first command after reattach.