The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
simplify(compat): repoint the last stragglers (run_agent computer_use import, 8 test files patching old facade paths)
Teknium4fcd9ede33be
diff --git a/run_agent.py b/run_agent.pyindex f6d31bc8e22..d64048251dc 100644--- a/run_agent.py+++ b/run_agent.py@@ -931,7 +931,7 @@ class AIAgent(process_registry.kill_all(task_id=task_id)def release_computer_use() -> None:- from tools.computer_use import release_computer_use_session+ from tools.computer_use.tool import release_computer_use_sessionrelease_computer_use_session(task_id)for step in (kill_processes, lambda: cleanup_vm(task_id), lambda: cleanup_browser(task_id), release_computer_use):diff --git a/tests/cron/test_cron_run_stale_claim_reap_86721.py b/tests/cron/test_cron_run_stale_claim_reap_86721.pyindex 8cb2780d2ee..97baf798302 100644--- a/tests/cron/test_cron_run_stale_claim_reap_86721.py+++ b/tests/cron/test_cron_run_stale_claim_reap_86721.py@@ -127,7 +127,7 @@ def test_try_dispatch_background_run_calls_recovery_before_claiming(monkeypatch)"gateway.session_context.async_delivery_supported", lambda: True)monkeypatch.setattr(- "tools.approval.get_current_session_key", lambda default="": ""+ "tools.approval_context.get_current_session_key", lambda default="": "")job = {"id": "unit-test-job", "name": "unit test job", "deliver": "local"}diff --git a/tests/hermes_cli/test_update_fleet_restart_pending.py b/tests/hermes_cli/test_update_fleet_restart_pending.pyindex d5da6456e9e..2a57f707884 100644--- a/tests/hermes_cli/test_update_fleet_restart_pending.py+++ b/tests/hermes_cli/test_update_fleet_restart_pending.py@@ -82,7 +82,7 @@ def _patch_update_deps(monkeypatch, tmp_path, run_side_effect):"_get_origin_url",lambda *a, **k: "https://github.com/NousResearch/hermes-agent.git",)- monkeypatch.setattr(hermes_main, "_is_fork", lambda *a, **k: False)+ monkeypatch.setattr(update_cmd, "_is_fork", lambda *a, **k: False)monkeypatch.setattr(hermes_main, "_stash_local_changes_if_needed", lambda *a, **k: None)@@ -99,8 +99,7 @@ def _patch_update_deps(monkeypatch, tmp_path, run_side_effect):)monkeypatch.setattr(hermes_main, "_write_update_incomplete_marker", lambda: None)monkeypatch.setattr(hermes_main, "_clear_update_incomplete_marker", lambda: None)- monkeypatch.setattr(- hermes_main, "_finish_dashboard_update_cleanup", lambda *a, **k: None+ monkeypatch.setattr(update_cmd, "_finish_dashboard_update_cleanup", lambda *a, **k: None)monkeypatch.setattr(update_cmd, "_finish_dashboard_update_cleanup", lambda *a, **k: Nonediff --git a/tests/hermes_cli/test_update_handoff_exit.py b/tests/hermes_cli/test_update_handoff_exit.pyindex f392cba0192..4b963c1ba8c 100644--- a/tests/hermes_cli/test_update_handoff_exit.py+++ b/tests/hermes_cli/test_update_handoff_exit.py@@ -21,6 +21,7 @@ from types import SimpleNamespaceimport pytestimport hermes_cli.main as main_mod+from hermes_cli import update_cmdfrom hermes_cli.main import cmd_update@@ -62,7 +63,7 @@ def _run_cmd_update(monkeypatch, impl, *, reexec: bool):monkeypatch.setattr("hermes_cli.config.is_managed", lambda: False)monkeypatch.setattr("hermes_cli.config.detect_install_method", lambda root: "git")monkeypatch.setattr("hermes_cli.update_lock.UpdateLock", lambda: _FakeLock(events["order"]))- monkeypatch.setattr(main_mod, "_cmd_update_impl", fake_impl)+ monkeypatch.setattr(update_cmd, "_cmd_update_impl", fake_impl)monkeypatch.setattr(main_mod, "_install_hangup_protection", lambda gateway_mode=False: None)monkeypatch.setattr(main_mod, "_finalize_update_output", fake_finalize_io)monkeypatch.setattr("hermes_cli.update_receipt.finalize_pending_update_receipt", fake_receipt)diff --git a/tests/hermes_cli/test_update_head_moved_gate.py b/tests/hermes_cli/test_update_head_moved_gate.pyindex f363dac4117..34d83a38453 100644--- a/tests/hermes_cli/test_update_head_moved_gate.py+++ b/tests/hermes_cli/test_update_head_moved_gate.py@@ -14,6 +14,7 @@ from types import SimpleNamespaceimport pytestfrom hermes_cli import main as hermes_main+from hermes_cli import update_cmddef _make_head_moved_side_effect(pre_sha="abc123", post_sha="def456"):@@ -83,7 +84,7 @@ def _patch_update_deps(monkeypatch, tmp_path, run_side_effect):hermes_main, "_get_origin_url",lambda *a, **k: "https://github.com/NousResearch/hermes-agent.git",)- monkeypatch.setattr(hermes_main, "_is_fork", lambda *a, **k: False)+ monkeypatch.setattr(update_cmd, "_is_fork", lambda *a, **k: False)monkeypatch.setattr(hermes_main, "_stash_local_changes_if_needed", lambda *a, **k: None)@@ -104,7 +105,7 @@ def _patch_update_deps(monkeypatch, tmp_path, run_side_effect):monkeypatch.setattr(hermes_main, "_write_update_incomplete_marker", lambda: None)monkeypatch.setattr(hermes_main, "_clear_update_incomplete_marker", lambda: None)# Gateway restart path (called after a successful update).- monkeypatch.setattr(hermes_main, "_finish_dashboard_update_cleanup", lambda *a: None)+ monkeypatch.setattr(update_cmd, "_finish_dashboard_update_cleanup", lambda *a: None)# Keep the (now surfaced — #78574) gateway auto-restart phase away from# this machine's real gateways: discovery returns nothing, systemd is# unsupported, so the phase is a clean no-op for both snapshots.diff --git a/tests/hermes_cli/test_update_parked_branch_guard.py b/tests/hermes_cli/test_update_parked_branch_guard.pyindex 2508606b3a1..3d293c28fe3 100644--- a/tests/hermes_cli/test_update_parked_branch_guard.py+++ b/tests/hermes_cli/test_update_parked_branch_guard.py@@ -255,8 +255,8 @@ def _patch_update_flow(monkeypatch, repo, run_real_git=True):hermes_main, "_get_origin_url",lambda *a, **k: "https://github.com/NousResearch/hermes-agent.git",)- monkeypatch.setattr(hermes_main, "_is_fork", lambda *a, **k: False)- monkeypatch.setattr(hermes_main, "_discard_lockfile_churn", lambda *a, **k: None)+ monkeypatch.setattr(update_cmd, "_is_fork", lambda *a, **k: False)+ monkeypatch.setattr(update_cmd, "_discard_lockfile_churn", lambda *a, **k: None)monkeypatch.setattr(update_cmd, "_discard_lockfile_churn", lambda *a, **k: None)monkeypatch.setattr(update_cmd, "_normalize_managed_eol", lambda *a, **k: None)monkeypatch.setattr(hermes_main, "_clear_bytecode_cache", lambda *a, **k: 0)diff --git a/tests/hermes_cli/test_update_receipt.py b/tests/hermes_cli/test_update_receipt.pyindex 01b38914b68..e7d1b2e778f 100644--- a/tests/hermes_cli/test_update_receipt.py+++ b/tests/hermes_cli/test_update_receipt.py@@ -17,6 +17,7 @@ from pathlib import Pathimport pytestimport hermes_cli.update_receipt as ur+from hermes_cli import update_cmd@pytest.fixture()@@ -217,7 +218,7 @@ class TestCommandBoundaryFinalization:ur.record_step("windows_preflight", False, "hermes.exe holds venv")sys.exit(2)- monkeypatch.setattr(hermes_main, "_cmd_update_impl", _fake_impl)+ monkeypatch.setattr(update_cmd, "_cmd_update_impl", _fake_impl)monkeypatch.setattr(hermes_main, "detect_install_method", lambda *a, **k: "git", raising=False)diff --git a/tests/test_resource_limits.py b/tests/test_resource_limits.pyindex 6f24ce0e512..51a9e8c5539 100644--- a/tests/test_resource_limits.py+++ b/tests/test_resource_limits.py@@ -11,6 +11,8 @@ from types import SimpleNamespaceimport pytestfrom hermes_cli import resource_limits+from hermes_cli import dashboard_procs+from hermes_cli import main_dashboardclass _FakeResource:@@ -270,7 +272,7 @@ def test_named_profile_reroute_defers_limit_to_final_process(monkeypatch, tmp_pa"get_active_profile_name",lambda: "worker",)- monkeypatch.setattr(cli_main, "_dashboard_listening", lambda *args: False)+ monkeypatch.setattr(main_dashboard, "_dashboard_listening", lambda *args: False)monkeypatch.setattr(local_environment,"build_subprocess_env",@@ -325,7 +327,7 @@ def test_dashboard_lifecycle_flags_skip_limit_adjustment(monkeypatch, lifecycle_"apply_nofile_soft_limit",lambda: calls.append("limit"),)- monkeypatch.setattr(cli_main, "_scan_dashboard_processes", lambda: [])+ monkeypatch.setattr(dashboard_procs, "_scan_dashboard_processes", lambda: [])monkeypatch.setattr(cli_main, "_find_stale_dashboard_pids", lambda: [])args = SimpleNamespace(diff --git a/tests/tui_gateway/test_subprocess_encoding.py b/tests/tui_gateway/test_subprocess_encoding.pyindex 91cabb187d6..a1dd0bbc1a5 100644--- a/tests/tui_gateway/test_subprocess_encoding.py+++ b/tests/tui_gateway/test_subprocess_encoding.py@@ -95,8 +95,8 @@ def test_shell_exec_uses_utf8_replace():handler = server._methods["shell.exec"]with patch("subprocess.run", return_value=_make_completed_process()) as mock_run:# A harmless, non-dangerous command that passes the approval gate.- with patch("tools.approval.detect_hardline_command", return_value=(False, "")), \- patch("tools.approval.detect_dangerous_command", return_value=(False, None, "")):+ with patch("tools.approval_detection.detect_hardline_command", return_value=(False, "")), \+ patch("tools.approval_detection.detect_dangerous_command", return_value=(False, None, "")):resp = handler(1, {"command": "echo hello"})assert mock_run.called, "subprocess.run was not invoked"kwargs = mock_run.call_args[1]