fix(tui): harden active-session temp file handling

- create HERMES_TUI_ACTIVE_SESSION_FILE with mkstemp instead of a predictable tmp path and always cleanup in finally
- add assertions that launch wiring uses a randomized session file path and removes it on exit
This commit is contained in:
Brooklyn Nicholson 2026-04-26 22:51:18 -05:00 committed by Teknium
parent 4b28140912
commit 7a6128cc4f
2 changed files with 19 additions and 12 deletions

View file

@ -145,6 +145,10 @@ def test_launch_tui_exports_model_and_provider(monkeypatch, main_mod):
assert env["HERMES_INFERENCE_MODEL"] == "nous/hermes-test"
assert env["HERMES_TUI_PROVIDER"] == "nous"
assert env["HERMES_INFERENCE_PROVIDER"] == "nous"
active_path = Path(env["HERMES_TUI_ACTIVE_SESSION_FILE"])
assert active_path.name.startswith("hermes-tui-active-session-")
assert active_path.suffix == ".json"
assert not active_path.exists()
assert env["NODE_ENV"] == "production"