mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
model_switch bound launch-profile turns to server._hermes_home, the home frozen at import, and read <that home>/.env through launch_secret_scope. The launch state.db handle already resolves the launch home at call time (#112692: the patched _hermes_home when a test changed it, else the live process home) precisely so a harness that re-homes the process after import is honoured; the secrets path did not, so under a developer shell with a custom HERMES_HOME every turn read the import-time home's .env — a guarded root for the suite — and test_compute_host_turn_protocol ran 2 failed + 1 error under a bare pytest. Share one _launch_home() between both paths. Restore that file's _wait timeout to main's 5 s: the 20 s bump only stretched the wait for a turn.end that the guard error had already made impossible.
20 lines
1.2 KiB
Python
20 lines
1.2 KiB
Python
"""The launch home the TUI server binds launch-profile turns to must follow the process home."""
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Imported at collection on purpose: that is when real test modules import the server,
|
|
# before any per-test fixture redirects HERMES_HOME, so ``_hermes_home`` freezes to the
|
|
# pre-fixture home exactly as it does for the rest of the suite.
|
|
from tui_gateway import server
|
|
from tui_gateway.launch_profile_policy import launch_secret_scope
|
|
|
|
|
|
def test_launch_home_follows_the_process_home_redirected_after_import():
|
|
"""``server._hermes_home`` is get_hermes_home() at import — under a developer shell the
|
|
honored custom HERMES_HOME, a guarded root. Launch-profile turns read ``<launch home>/.env``
|
|
(``launch_secret_scope``), so the home they bind must be resolved at call time from the
|
|
process env, like the launch ``state.db`` handle (#112692), never the import-time value."""
|
|
sandbox = Path(os.environ["HERMES_HOME"])
|
|
assert server._launch_home() == sandbox
|
|
(sandbox / ".env").write_text("HERMES_LAUNCH_HOME_PROBE=from-sandbox\n", encoding="utf-8")
|
|
assert launch_secret_scope(server._launch_home()).get("HERMES_LAUNCH_HOME_PROBE") == "from-sandbox"
|