Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(devbox): quote IdentityAgent socket path in coder ssh config (#59399)

Georges-Antoine Assid5d2bff23bb3
diff --git a/tools/hogli-commands/hogli_commands/devbox/coder.py b/tools/hogli-commands/hogli_commands/devbox/coder.py
index e167b710d76d..b17890d2b801 100644
--- a/tools/hogli-commands/hogli_commands/devbox/coder.py
+++ b/tools/hogli-commands/hogli_commands/devbox/coder.py
@@ -617,7 +617,7 @@ def _config_ssh_args(*, identity_agent_socket: str | None = None) -> list[str]:
args += ["--coder-binary-path", str(managed)]
args += ["--ssh-option", "ForwardAgent yes"]
if identity_agent_socket:
- args += ["--ssh-option", f"IdentityAgent {identity_agent_socket}"]
+ args += ["--ssh-option", f'IdentityAgent "{identity_agent_socket}"']
return args
diff --git a/tools/hogli-commands/hogli_commands/tests/test_devbox.py b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
index 571bcdd68a1f..7b5cb2a1cf69 100644
--- a/tools/hogli-commands/hogli_commands/tests/test_devbox.py
+++ b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
@@ -2205,6 +2205,29 @@ class TestResolveLocalIdentityAgent:
assert devbox_cli._resolve_local_identity_agent("coder.dev") is None
+class TestConfigSshArgs:
+ """Test the `coder config-ssh` arg assembly."""
+
+ def test_omits_identity_agent_when_socket_missing(self) -> None:
+ args = coder._config_ssh_args(identity_agent_socket=None)
+ assert "ForwardAgent yes" in args
+ assert not any("IdentityAgent" in a for a in args)
+
+ @pytest.mark.parametrize(
+ "socket",
+ [
+ # 1Password's default path contains spaces; without quoting,
+ # OpenSSH parses the trailing path components as "extra arguments"
+ # and refuses to load the config file.
+ "/Users/me/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock",
+ "/tmp/agent.sock",
+ ],
+ )
+ def test_quotes_identity_agent_socket(self, socket: str) -> None:
+ args = coder._config_ssh_args(identity_agent_socket=socket)
+ assert f'IdentityAgent "{socket}"' in args
+
+
class TestSetupGitSigning:
"""Test the Git commit signing step in devbox:setup.