The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(agent): keep the auxiliary cache suite hermetic on hosts with an ambient Claude Code login
liuhao10243bc625066411
diff --git a/tests/agent/test_auxiliary_client_cache_follows_credential.py b/tests/agent/test_auxiliary_client_cache_follows_credential.pyindex 6fe11964ce0..5dca89b814e 100644--- a/tests/agent/test_auxiliary_client_cache_follows_credential.py+++ b/tests/agent/test_auxiliary_client_cache_follows_credential.py@@ -9,6 +9,7 @@ import timeimport pytest+import agent.anthropic_credentials as anth_credimport agent.auxiliary_client as auxfrom hermes_cli.auth import write_credential_pool@@ -29,9 +30,23 @@ def _seed(provider: str, token: str, *, model_cooldown: str | None = None) -> Nodef isolated_home(tmp_path, monkeypatch):monkeypatch.setenv("HERMES_HOME", str(tmp_path / "hermes"))monkeypatch.setattr(aux, "_client_cache", {})+ # HERMES_HOME only redirects Hermes-owned state; the borrowed Claude Code+ # reader still consults ~/.claude/.credentials.json and the macOS Keychain,+ # so an ambient login on the host would seed a second un-cooled-down pool+ # entry and break the cooldown assertions below (#114424).+ monkeypatch.setattr(anth_cred, "read_claude_code_credentials", lambda: None)return tmp_path / "hermes"+def test_isolated_home_hides_ambient_borrowed_credentials(isolated_home):+ """The suite stays hermetic on hosts with an ambient Claude Code login (#114424)."""+ assert anth_cred.read_claude_code_credentials() is None+ _seed("anthropic", "tok-old", model_cooldown=MODEL)+ pool = aux._load_pool_with_credentials("anthropic")+ assert [entry.source for entry in pool.entries()] == ["manual"]+ assert aux._pool_cache_hint("anthropic").startswith("anthropic::")++@pytest.mark.parametrize("provider", ["anthropic", "openai-codex"])def test_pool_token_rotation_changes_cache_key_and_hides_the_secret(isolated_home, provider):"""Same entry id, new token -> different key; the token itself never enters the key."""