Skip to content

The agent that grows with you

fix(auth): return the user-local external CLI as one native path on Windows

Brooklyn Nicholson865ba906c1a8
diff --git a/hermes_cli/auth_external_process.py b/hermes_cli/auth_external_process.py
index 70de4624343..4a47f3681f7 100644
--- a/hermes_cli/auth_external_process.py
+++ b/hermes_cli/auth_external_process.py
@@ -24,7 +24,9 @@ def resolve_external_process_command(command: str) -> Optional[str]:
lookup = os.path.abspath(os.path.expandvars(os.path.expanduser(command)))
found = locate_command(lookup, known_dirs=user_local_bin()).command
if found:
- return found[0]
+ # Known dirs are written with "/" (%USERPROFILE%/.local/bin); normalize so a Windows hit
+ # reads as one native path in status and in the spawned argv.
+ return os.path.normpath(found[0])
from agent.anthropic_adapter import find_claude_code_cli
return find_claude_code_cli(command)
diff --git a/tests/hermes_cli/test_external_process_auth_status.py b/tests/hermes_cli/test_external_process_auth_status.py
index 0281bfa4a9c..6f5e73ef369 100644
--- a/tests/hermes_cli/test_external_process_auth_status.py
+++ b/tests/hermes_cli/test_external_process_auth_status.py
@@ -80,6 +80,25 @@ def test_external_process_status_finds_user_local_cli_outside_backend_path(
assert resolve_external_process_provider_credentials("copilot-acp")["command"] == str(cli)
+def test_external_process_status_finds_user_profile_local_cli_as_native_path(
+ tmp_path, monkeypatch, _clean_copilot_env
+):
+ """The Windows user-local hit is one native path, not a mixed-separator join."""
+ local_bin = tmp_path / ".local" / "bin"
+ local_bin.mkdir(parents=True)
+ cli = local_bin / "copilot.exe"
+ cli.write_text("", encoding="utf-8")
+ monkeypatch.setenv("PATH", str(tmp_path / "backend-bin"))
+
+ status = get_external_process_provider_status("copilot-acp")
+ resolved = status["resolved_command"]
+
+ assert status["configured"] is True
+ assert "/" not in resolved and os.path.samefile(resolved, cli)
+ assert resolve_external_process_provider_credentials("copilot-acp")["command"] == resolved
+
+
def test_external_process_status_resolves_relative_configured_path_from_cwd(
tmp_path, monkeypatch, _clean_copilot_env
):