From c83ea25dd4c222ad2c8dc31925719831c0a5ea2f Mon Sep 17 00:00:00 2001 From: f-trycua <195596869+f-trycua@users.noreply.github.com> Date: Sun, 16 Aug 2026 12:50:04 -0500 Subject: [PATCH] fix(computer-use): preserve missing driver overrides --- hermes_cli/tools_config.py | 14 ++++++++++++++ tests/hermes_cli/test_install_cua_driver.py | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py index 846a6857c8..8db88ec0c4 100644 --- a/hermes_cli/tools_config.py +++ b/hermes_cli/tools_config.py @@ -1039,6 +1039,20 @@ def install_cua_driver( driver_cmd = _cua_driver_cmd() binary = _resolved_cua_driver_cmd() + # An explicit override is authoritative even when it is currently broken. + # Do not install or replace the standard system driver: that cannot repair + # the configured path and would mutate an unrelated installation. + override = os.environ.get("HERMES_CUA_DRIVER_CMD", "").strip() + if override and not binary: + _print_warning( + " HERMES_CUA_DRIVER_CMD does not resolve to an executable: " + f"{override}" + ) + _print_info( + " Fix or unset the override before running computer-use install." + ) + return False + # Not installed → fresh install path (only when caller asked for it). if not binary and not upgrade: if not _cua_install_target_writable(): diff --git a/tests/hermes_cli/test_install_cua_driver.py b/tests/hermes_cli/test_install_cua_driver.py index 03e7012fce..a6a8941b9f 100644 --- a/tests/hermes_cli/test_install_cua_driver.py +++ b/tests/hermes_cli/test_install_cua_driver.py @@ -388,6 +388,23 @@ class TestInstallCuaDriverUpgrade: runner.assert_not_called() + @pytest.mark.parametrize("upgrade", [False, True]) + def test_missing_explicit_override_does_not_install_standard_driver( + self, monkeypatch, upgrade + ): + from hermes_cli import tools_config + + monkeypatch.setenv("HERMES_CUA_DRIVER_CMD", "/missing/custom/cua-driver") + with patch.object( + tools_config, + "_resolved_cua_driver_cmd", + return_value=None, + ), \ + patch.object(tools_config, "_run_cua_driver_installer") as runner: + assert tools_config.install_cua_driver(upgrade=upgrade) is False + + runner.assert_not_called() + def test_non_upgrade_without_binary_runs_installer(self): from hermes_cli import tools_config