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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3a94ea3. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces new functionality that automatically discovers and injects SSH agent sockets into terminal sessions - changing runtime behavior for how terminals are spawned. While well-tested, this is new capability rather than a simple bug fix and warrants human review. You can customize Macroscope's approvability policy. Learn more. |

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 on POSIX with uid-checked socket discovery; runtime overrides are preserved and Windows skips scanning.
Overview
Fixes devcontainer terminals missing SSH agent access when the server starts before VS Code injects a forwarded socket.
Adds
resolveSshAuthSockin@t3tools/shared/sshAgent: reuse a valid same-user inheritedSSH_AUTH_SOCK, otherwise on POSIX scan the process temp dir and/tmpfor the newest same-uservscode-ssh-auth-*.sock, with injectablereaddir/statfor tests.createTerminalSpawnEnvin the terminal manager now setsSSH_AUTH_SOCKfrom an optionalsshAuthSockResolver(defaulting to that helper) before applying runtime env, soopen()env overrides still win. Exports the new module and adds unit/integration tests for resolver and spawn behavior.Reviewed by Cursor Bugbot for commit ac1daf4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Hydrate SSH_AUTH_SOCK in devcontainer terminal spawn environment
resolveSshAuthSockinpackages/shared/src/sshAgent.tsthat returns a suitable SSH agent socket path by preferring a valid inheritedSSH_AUTH_SOCKor falling back to the newest same-user VS Code forwarded socket in temp directories.createTerminalSpawnEnvinapps/server/src/terminal/Layers/Manager.ts, injectingSSH_AUTH_SOCKbefore spawning terminal processes, withruntimeEnvvalues taking precedence.makeTerminalManagerWithOptionswill now haveSSH_AUTH_SOCKset by default if one can be resolved from the environment.Macroscope summarized ac1daf4.