Skip to content

The agent that grows with you

test(e2e): exercise Windows source launcher under PM test environment

ethernetb91d1c931eee
diff --git a/tests/e2e/core/windows/_helpers.py b/tests/e2e/core/windows/_helpers.py
index e4b4cc47e56..438ab0201cf 100644
--- a/tests/e2e/core/windows/_helpers.py
+++ b/tests/e2e/core/windows/_helpers.py
@@ -1,6 +1,6 @@
"""Shared harness for the native-Windows end-to-end suite.
-Every test drives REAL Hermes processes (``hermes.exe`` / ``python -m
+Every test drives REAL Hermes processes (the source launcher / ``python -m
hermes_cli.main``) on a real Windows host against the recording loopback
provider (``tests/fakes/fake_llm_provider.py``). Nothing in Hermes is mocked;
verdicts come from what reached the provider wire, what landed in ``state.db``
@@ -112,11 +112,22 @@ def hermes_argv(*args: str) -> list[str]:
return [sys.executable, "-m", "hermes_cli.main", *args]
-def hermes_exe() -> Path:
- """The console-script shim users actually launch (``<venv>\\Scripts\\hermes.exe``)."""
- exe = Path(sys.executable).with_name("hermes.exe")
- assert exe.is_file(), f"hermes.exe console script missing next to {sys.executable}"
- return exe
+def hermes_exe(home: WinHome) -> Path:
+ """Publish a real source launcher in the isolated user's bin directory.
+
+ PM's side test environment has dependencies but no console script. The
+ production launcher writer binds this checkout to that selected interpreter;
+ a scratch home keeps its dependencies in that interpreter, not PM install
+ facts for the runner's real home.
+ """
+ from hermes_cli._launchers import mint_launcher
+
+ bin_dir = home.profile / "AppData" / "Local" / "hermes" / "bin"
+ bin_dir.mkdir(parents=True, exist_ok=True)
+ launcher = mint_launcher("hermes", REPO_ROOT, bin_dir, Path(sys.executable), None)
+ assert launcher is not None and launcher.suffix.lower() == ".exe" and launcher.is_file(), (
+ f"could not publish source hermes.exe in {bin_dir}: {launcher}")
+ return launcher
@dataclass
diff --git a/tests/e2e/core/windows/test_boot_lifecycle.py b/tests/e2e/core/windows/test_boot_lifecycle.py
index 8e8f85c32a1..9f88acc0fec 100644
--- a/tests/e2e/core/windows/test_boot_lifecycle.py
+++ b/tests/e2e/core/windows/test_boot_lifecycle.py
@@ -1,8 +1,7 @@
"""Boot and lifecycle of the real Hermes processes on native Windows.
-* ``hermes.exe --version`` — the console-script shim users launch starts and reports
- the installed package version.
-* ``hermes.exe chat -q`` — one oneshot turn against the loopback provider: the reply is
+* The source launcher ``hermes.exe`` reports checkout version and runs a
+ one-shot chat turn: the reply is
printed, the prompt reached the wire, and both messages persisted to ``state.db`` under
the session id the CLI announced.
* ``hermes serve`` (the Desktop backend) — announces its port on stdout, and after the
@@ -17,7 +16,6 @@
from __future__ import annotations
-import importlib.metadata
import json
import queue
import re
@@ -29,6 +27,7 @@ from pathlib import Path
import pytest
+from hermes_cli.version_info import get_version_info
from tests.e2e.core.windows._helpers import (
WinHome,
db_rows,
@@ -54,19 +53,21 @@ pytestmark = [pytest.mark.platforms("windows"), pytest.mark.integration, pytest.
READY_TIMEOUT = 120.0
-def test_version_reports_installed_package(tmp_path: Path) -> None:
+def test_version_reports_checkout_identity(tmp_path: Path) -> None:
home = make_home(tmp_path, "http://127.0.0.1:9/v1") # never contacted by --version
- res = run([str(hermes_exe()), "--version"], home, timeout=120)
+ res = run([str(hermes_exe(home)), "--version"], home, timeout=120)
assert res.returncode == 0, res.tail()
- version = importlib.metadata.version("hermes-agent")
- assert f"v{version}" in res.stdout, f"--version does not report the installed {version}:\n{res.tail()}"
+ version = get_version_info().derived_version
+ assert version != "unknown", "the checkout must have a readable release or commit identity"
+ assert f"Hermes Agent v{version} (" in res.stdout, (
+ f"--version does not report this checkout's {version}:\n{res.tail()}")
def test_chat_oneshot_turn_persists(tmp_path: Path) -> None:
prompt_id, reply_id = nonce("PROMPT"), nonce("REPLY")
with FakeLLMServer([Text(f"The answer is {reply_id}.")]) as srv:
home = make_home(tmp_path, srv.base_url)
- res = run([str(hermes_exe()), "chat", "-q", f"Say the code {prompt_id}", "-Q"], home)
+ res = run([str(hermes_exe(home)), "chat", "-q", f"Say the code {prompt_id}", "-Q"], home)
assert res.returncode == 0, res.tail()
assert reply_id in res.stdout, f"reply not printed:\n{res.tail()}"
mains = srv.main_requests()