fix: hydrate devcontainer ssh agent socket#3068
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 |
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces new SSH agent socket discovery and hydration functionality that changes terminal spawn behavior. Combined with an open high-severity review comment about potential Windows compatibility issues, these changes warrant human review. You can customize Macroscope's approvability policy. Learn more. |
ac1daf4 to
70ce9c4
Compare
70ce9c4 to
8a655cb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8a655cb. Configure here.
|
Rebased the PR. |
8a655cb to
c28dfed
Compare
330c94f to
d59d65b
Compare
d59d65b to
6042f22
Compare

What Changed
Fix terminal PTY environment hydration for devcontainers by resolving a usable
SSH_AUTH_SOCKwhen spawning terminal sessions.The change:
SSH_AUTH_SOCK/tmp/vscode-ssh-auth-*.sockWhy
Fixes #3067.
When the T3 Code server starts before VS Code attaches to a devcontainer, the server process does not inherit VS Code’s later-injected forwarded SSH agent environment. Terminals spawned by that server therefore miss
SSH_AUTH_SOCK, even though the forwarded socket exists and works in normal VS Code terminals.Resolving the socket at terminal spawn time makes server-started terminals match the attached devcontainer environment without requiring a server restart.
Checklist
Note
Low Risk
Scoped to terminal spawn env and SSH agent socket discovery; behavior change is intentional (stale sockets dropped) with solid unit coverage.
Overview
Fixes devcontainer terminals missing SSH agent forwarding when the server starts before VS Code injects
SSH_AUTH_SOCK.Adds
resolveSshAuthSockin shared (@t3tools/shared/sshAgent): on POSIX, reuse a valid same-user inherited socket or pick the newest matching VS Code forwarded socket under temp//tmp; on Windows, only accept OpenSSH named pipes.createTerminalSpawnEnvno longer copiesSSH_AUTH_SOCKfrom the server process—it sets it via the resolver (defaulting toresolveSshAuthSock), and runtime open env can still override.TerminalManagerwires an injectablesshAuthSockResolverfor tests.Reviewed by Cursor Bugbot for commit 6042f22. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix SSH agent socket resolution in devcontainer terminals
resolveSshAuthSockinpackages/shared/src/sshAgent.tsto compute a validSSH_AUTH_SOCKpath: on POSIX it validates the inherited socket by type/uid or falls back to scanning temp directories for VS Code forwarded sockets; on Windows it only accepts named pipe values.createTerminalSpawnEnvinapps/server/src/terminal/Manager.tsnow strips the inheritedSSH_AUTH_SOCKand replaces it using the resolver, preventing stale or inaccessible socket paths from propagating into terminal processes.runtimeEnvvalues still override the resolved socket, preserving existing override behavior.SSH_AUTH_SOCKis no longer passed through from the base environment; it is always re-resolved unless explicitly set viaruntimeEnv.Macroscope summarized 6042f22.