Skip to content

The agent that grows with you

fix(computer-use): preserve missing driver overrides

f-trycuac83ea25dd4c2
diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py
index 846a6857c84..8db88ec0c46 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 03e7012fcee..a6a8941b9f7 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