From a4b4e583f2a551332d8beba76b1601c0f1aacc9b Mon Sep 17 00:00:00 2001 From: twentyOne2x Date: Sun, 12 Jul 2026 22:39:14 +0200 Subject: [PATCH] Run GCP Cory replay with Hermes Python --- scripts/run_gcp_generated_db_direct_claim_suite.py | 13 +++++++++++++ tests/test_gcp_generated_db_direct_claim_suite.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/scripts/run_gcp_generated_db_direct_claim_suite.py b/scripts/run_gcp_generated_db_direct_claim_suite.py index 7b3abdc..190074b 100644 --- a/scripts/run_gcp_generated_db_direct_claim_suite.py +++ b/scripts/run_gcp_generated_db_direct_claim_suite.py @@ -19,6 +19,19 @@ from pathlib import Path from types import SimpleNamespace from typing import Any +GCP_HERMES_PYTHON = Path("/home/teleo/.hermes/hermes-agent/venv/bin/python") + + +def should_reexec_in_hermes(current_python: Path, target_python: Path = GCP_HERMES_PYTHON) -> bool: + return target_python.is_file() and current_python.resolve() != target_python.resolve() + + +if __name__ == "__main__" and should_reexec_in_hermes(Path(sys.executable)): + os.execv( + str(GCP_HERMES_PYTHON), + [str(GCP_HERMES_PYTHON), str(Path(__file__).resolve()), *sys.argv[1:]], + ) + HERE = Path(__file__).resolve().parent sys.path.insert(0, str(HERE)) diff --git a/tests/test_gcp_generated_db_direct_claim_suite.py b/tests/test_gcp_generated_db_direct_claim_suite.py index 59684df..4b3913d 100644 --- a/tests/test_gcp_generated_db_direct_claim_suite.py +++ b/tests/test_gcp_generated_db_direct_claim_suite.py @@ -8,6 +8,7 @@ from pathlib import Path import pytest from scripts.run_gcp_generated_db_direct_claim_suite import ( + GCP_HERMES_PYTHON, REVIEWED_CLOUDSQL_TOOL_SHA256, REVIEWED_MANIFEST_SQL_SHA256, audit_structured_count_readbacks, @@ -16,6 +17,7 @@ from scripts.run_gcp_generated_db_direct_claim_suite import ( direct_prompts, normalize_database_manifest_rows, run_suite, + should_reexec_in_hermes, validate_database_identity, validate_parity_receipt, ) @@ -36,6 +38,17 @@ def test_direct_prompt_catalog_is_the_exact_six_case_suite() -> None: validate_read_only_bridge_argv(["list-proposals", "--status", "rejected"]) +def test_gcp_runner_reexecs_from_system_python_into_hermes_venv(tmp_path: Path) -> None: + system_python = tmp_path / "system-python" + hermes_python = tmp_path / "hermes-python" + system_python.touch() + hermes_python.touch() + + assert should_reexec_in_hermes(system_python, hermes_python) is True + assert should_reexec_in_hermes(hermes_python, hermes_python) is False + assert str(GCP_HERMES_PYTHON) == "/home/teleo/.hermes/hermes-agent/venv/bin/python" + + def test_structured_count_readback_audit_rejects_plausible_but_false_counts() -> None: status = { "high_signal_rows": {