The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(computer-use): doctor diagnoses a denied cua-driver spawn instead of crashing
teknium1a4d474777fa1
diff --git a/tests/computer_use/test_doctor.py b/tests/computer_use/test_doctor.pyindex ad7c699c50f..89b524fd8f0 100644--- a/tests/computer_use/test_doctor.py+++ b/tests/computer_use/test_doctor.py@@ -144,6 +144,17 @@ class TestDoctorExitCodes:code = doctor.run_doctor()assert code == 1+ def test_spawn_denied_exits_2_with_diagnosis(self, capsys):+ """The runtime interpreter cannot execute the resolved binary (Windows WinError 5 on a+ `WindowsApps` install): a diagnosis + exit 2, never a raw traceback."""+ from tools.computer_use import doctor++ with patch("shutil.which", return_value="/protected/cua-driver"), \+ patch("subprocess.Popen", side_effect=PermissionError(13, "Access is denied")):+ code = doctor.run_doctor()+ assert code == 2+ err = capsys.readouterr().err+ assert "Access is denied" in err and "HERMES_CUA_DRIVER_CMD" in errdef test_protocol_error_exits_2(self, capsys):"""An empty stdout response (driver crashed during handshake) is adiff --git a/tools/computer_use/doctor.py b/tools/computer_use/doctor.pyindex 87470dd15a4..6c2fa7ddcc6 100644--- a/tools/computer_use/doctor.py+++ b/tools/computer_use/doctor.py@@ -339,6 +339,15 @@ def run_doctor(driver_cmd: Optional[str] = None, *, include: Sequence[str] = (),report = _drive_health_report(binary, include=include, skip=skip, timeout=12.0)except HealthReportUnavailable as e:report = _compose_fallback_report(binary, reason=str(e), timeout=12.0)+ except OSError as e:+ # The spawn itself failed (Windows: a venv interpreter denied `CreateProcess` on a binary under+ # `C:\Program Files\WindowsApps`, WinError 5). A traceback here hides the one fact the user needs.+ print(f"cua-driver could not be started from {binary!r}: {e}\n"+ " The Hermes runtime interpreter cannot execute this binary; the tool may still work because the\n"+ " shell resolves a different copy on PATH. Fix: install cua-driver outside the protected directory\n"+ " (e.g. the upstream installer's default under your user profile) or point HERMES_CUA_DRIVER_CMD at\n"+ " a copy the runtime can execute, then re-run `hermes computer-use doctor`.", file=sys.stderr)+ return 2except RuntimeError as e:print(f"cua-driver health_report failed: {e}", file=sys.stderr)return 2