fix(computer-use): preserve missing driver overrides

This commit is contained in:
f-trycua
2026-08-16 12:50:04 -05:00
committed by Teknium
parent 3162745276
commit c83ea25dd4
2 changed files with 31 additions and 0 deletions
+14
View File
@@ -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():
@@ -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