The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(test): isolate the fork-sync test from the host machine; abort at the reload proof point
Teknium4553e71993db
diff --git a/tests/hermes_cli/test_cmd_update.py b/tests/hermes_cli/test_cmd_update.pyindex 67fdf1b2614..9226d25c3f6 100644--- a/tests/hermes_cli/test_cmd_update.py+++ b/tests/hermes_cli/test_cmd_update.py@@ -265,9 +265,12 @@ class TestCmdUpdateBranchFallback:branch="main", verify_ok=True, commit_count="0")- # The first two reads bracket the upstream sync; later reads see the- # new HEAD while the normal update path finishes.- shas = iter(["aaaaaaa", "bbbbbbb"])+ # The first two reads bracket the upstream sync (aaaaaaa -> bbbbbbb:+ # the sync moved HEAD). The NEXT two bracket the pull inside the+ # normal update path (bbbbbbb -> ccccccc) — the head-moved no-op+ # guard added after this PR exits 1 when that pair is equal, so the+ # mock must show the pull advancing HEAD too.+ shas = iter(["aaaaaaa", "bbbbbbb", "bbbbbbb", "ccccccc"])with patch.object(hm,@@ -276,14 +279,45 @@ class TestCmdUpdateBranchFallback:), patch.object(update_cmd,"_capture_head_sha",- side_effect=lambda *_args, **_kwargs: next(shas, "bbbbbbb"),+ side_effect=lambda *_args, **_kwargs: next(shas, "ccccccc"),+ ), patch(+ # The full post-update path runs the fleet version check, which+ # reads the REAL machine's profile gateway_state.json files —+ # live gateways on a dev box read as STALE vs this checkout and+ # exit 1. Pin an empty fleet: this test asserts the post-update+ # path RUNS, not the fleet's health.+ "hermes_cli.update_receipt.collect_fleet_versions",+ return_value=[],+ ), patch(+ # Same isolation for the restart phase: without these, the real+ # machine's live gateways enter the restart discovery, the+ # mocked-subprocess restart phase can't verify replacements, and+ # the fail-closed contract (#78574) exits 1 (locally the+ # live-system guard blocks the os.kill outright).+ "hermes_cli.gateway.find_gateway_pids",+ return_value=[],+ ), patch(+ "hermes_cli.gateway.find_profile_gateway_processes",+ return_value=[],+ ), patch(+ "hermes_cli.gateway._get_service_pids",+ return_value=set(),), patch.object(hm, "_sync_with_upstream_if_needed"), patch.object(- hm, "_reload_updated_runtime_modules"+ hm,+ "_reload_updated_runtime_modules",+ # Reaching the reload step IS the proof the post-update path ran+ # (the bug returned from "Already up to date!" before it). Abort+ # the pipeline right here: everything past this point (skills+ # sync, desktop rebuild, gateway restart, fleet check) would run+ # for real against the host machine.+ side_effect=SystemExit(0),) as post_update_step:- cmd_update(mock_args)+ with pytest.raises(SystemExit) as exit_info:+ cmd_update(mock_args)+ assert exit_info.value.code == 0post_update_step.assert_called_once_with()captured = capsys.readouterr()assert "Already up to date!" not in captured.out