Skip to content

The agent that grows with you

test(auth): terminal 401 on a manual Codex grant is 'dead', not 'exhausted'

teknium1a7b13e68a994
diff --git a/tests/hermes_cli/test_auth_pool_operations.py b/tests/hermes_cli/test_auth_pool_operations.py
index d9b786d27ba..6959a4bfab8 100644
--- a/tests/hermes_cli/test_auth_pool_operations.py
+++ b/tests/hermes_cli/test_auth_pool_operations.py
@@ -73,9 +73,11 @@ def test_refresh_uses_target_grant_and_preserves_sibling(monkeypatch, status):
assert target.get("last_error_reset_at") is None
assert target["last_status"] == "ok"
else:
- # Manual grants remain in the pool on terminal failure; only
- # singleton-seeded grants are removed by the existing quarantine.
- assert target["last_status"] == "exhausted"
+ # Manual grants remain in the pool on failure; only singleton-seeded grants are removed
+ # by the quarantine. A transient 503 benches the row ('exhausted'); a terminal 401
+ # invalid_grant marks it 'dead' so it leaves rotation until re-auth instead of
+ # replaying the dead token every TTL.
+ assert target["last_status"] == ("dead" if status == 401 else "exhausted")
assert target["access_token"] == before[1]["access_token"]
finally:
server.shutdown()