fix(tests): pin gateway platform env in fallback-chain + session-row tests

#68229 flipped three assertions from platform/source 'tui' to 'desktop',
but _resolve_session_platform() is env-driven: it only returns 'desktop'
when HERMES_DESKTOP=1 is set (as it was in ethie's dev environment). On
CI neither env var is set, so _make_agent stamps platform='tui' and the
fallback-chain test failed — the assertion encoded a machine-local env,
not gateway behavior.

Restore the 'tui' expectations (matching the unset-env default the rest
of the suite assumes) and monkeypatch.delenv HERMES_DESKTOP /
HERMES_DESKTOP_TERMINAL in all three tests so they are deterministic on
any machine, including desktop-launched dev shells.
This commit is contained in:
Teknium 2026-07-22 11:12:58 -07:00
parent 1ed7a0c0fb
commit d3c43bcc34
No known key found for this signature in database

View file

@ -2501,6 +2501,10 @@ def test_make_agent_passes_configured_fallback_chain(monkeypatch):
monkeypatch.delenv("HERMES_MODEL", raising=False)
monkeypatch.delenv("HERMES_INFERENCE_MODEL", raising=False)
monkeypatch.delenv("HERMES_TUI_PROVIDER", raising=False)
# Platform resolution is env-driven (HERMES_DESKTOP → "desktop"); clear it
# so the assertion below is deterministic regardless of the dev machine.
monkeypatch.delenv("HERMES_DESKTOP", raising=False)
monkeypatch.delenv("HERMES_DESKTOP_TERMINAL", raising=False)
monkeypatch.setattr(
server,
"_load_cfg",
@ -2527,7 +2531,7 @@ def test_make_agent_passes_configured_fallback_chain(monkeypatch):
assert agent.model == "gpt-5.5"
assert captured["fallback_model"] == fallback_chain
assert captured["platform"] == "desktop"
assert captured["platform"] == "tui"
def test_background_agent_kwargs_preserves_full_fallback_chain(monkeypatch):
@ -3807,11 +3811,13 @@ def test_ensure_session_db_row_persists_explicit_cwd(monkeypatch, tmp_path):
monkeypatch.setattr(server, "_get_db", lambda: _FakeDB())
monkeypatch.setattr(server, "_resolve_model", lambda: "test-model")
monkeypatch.delenv("HERMES_DESKTOP", raising=False)
monkeypatch.delenv("HERMES_DESKTOP_TERMINAL", raising=False)
server._ensure_session_db_row({"session_key": "k1", "cwd": str(tmp_path), "explicit_cwd": True})
assert created == [
{"key": "k1", "source": "desktop", "model": "test-model", "model_config": None, "cwd": str(tmp_path)}
{"key": "k1", "source": "tui", "model": "test-model", "model_config": None, "cwd": str(tmp_path)}
]
@ -3847,11 +3853,13 @@ def test_ensure_session_db_row_defaults_to_no_workspace(monkeypatch, tmp_path):
monkeypatch.setattr(server, "_get_db", lambda: _FakeDB())
monkeypatch.setattr(server, "_resolve_model", lambda: "test-model")
monkeypatch.delenv("HERMES_DESKTOP", raising=False)
monkeypatch.delenv("HERMES_DESKTOP_TERMINAL", raising=False)
server._ensure_session_db_row({"session_key": "k1", "cwd": str(tmp_path)})
assert created == [
{"key": "k1", "source": "desktop", "model": "test-model", "model_config": None, "cwd": None}
{"key": "k1", "source": "tui", "model": "test-model", "model_config": None, "cwd": None}
]