mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 21:32:52 +00:00
Change-detectors, tautologies, source-reading tests, redundant duplicates, mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane ledger (category + reason for every removal).
46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
"""A ``blocked_config`` credential verdict names the profile + HERMES_HOME the scheduler actually
|
|
read (#116213): "No Codex credentials stored" from a gateway whose home differs from the shell that
|
|
works is otherwise indistinguishable from a genuine login gap."""
|
|
|
|
import json
|
|
import re
|
|
|
|
import pytest
|
|
|
|
from cron.scheduler_preflight import _preflight_check_provider_key
|
|
from cron.scheduler_provider import _profile_cron_scope
|
|
|
|
JOB = {"id": "7a6ae427c1d8", "name": "radar", "provider": "openai-codex", "model": "gpt-5.6-sol"}
|
|
|
|
|
|
@pytest.fixture
|
|
def two_homes(tmp_path, monkeypatch):
|
|
root = tmp_path / "root"
|
|
alpha = root / "profiles" / "alpha"
|
|
alpha.mkdir(parents=True)
|
|
for home in (root, alpha):
|
|
(home / "config.yaml").write_text("model:\n default: gpt-5.6-sol\n provider: openai-codex\n")
|
|
(root / "auth.json").write_text(json.dumps({"version": 1, "providers": {}}))
|
|
monkeypatch.setenv("HERMES_HOME", str(root))
|
|
monkeypatch.setenv("HOME", str(tmp_path / "home"))
|
|
monkeypatch.delenv("HERMES_PROFILE", raising=False)
|
|
return root, alpha
|
|
|
|
|
|
def _scope(reason: str) -> tuple:
|
|
match = re.search(r"\[profile '([^']+)', HERMES_HOME (.+?)\]", reason)
|
|
assert match, reason
|
|
return match.group(1), match.group(2)
|
|
|
|
|
|
def test_missing_codex_credential_verdict_names_the_home_it_read(two_homes):
|
|
root, alpha = two_homes
|
|
|
|
reason = _preflight_check_provider_key(JOB, {"cron": {}})
|
|
assert reason
|
|
assert _scope(reason) == ("default", str(root))
|
|
|
|
# Multiplex tick of a satellite profile: the verdict names alpha, not the gateway's launch home.
|
|
with _profile_cron_scope(alpha):
|
|
reason = _preflight_check_provider_key(JOB, {"cron": {}})
|
|
assert reason and _scope(reason) == ("alpha", str(alpha))
|