The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(free-tier): keep the proof-of-work verdict for pow_* off a 428
kshitijk4poor6dae8d059ad7
diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.pyindex c8df250d574..453fecc055e 100644--- a/hermes_cli/anon_auth.py+++ b/hermes_cli/anon_auth.py@@ -318,7 +318,7 @@ def _raise_for_anon_status(# the honest way forward is a sign-in, in the service's own words when it sent some.raise anon_challenge.signin_required_error(payload.get("message"))cls, code = (_NAS_REFUSALS.get((status, error)) or _NAS_REFUSALS.get((status, None))- or (AuthError, ANON_SERVER_ERROR))+ or ((AuthError, ANON_POW_REQUIRED) if error == "pow_" else (AuthError, ANON_SERVER_ERROR)))if code == ANON_SERVER_ERROR:logger.info("Nous free tier %s failed (%s%s)", action, status, f": {error}" if error else "")retry_after = parse_retry_after_seconds(response.headers)diff --git a/tests/hermes_cli/test_anon_challenge.py b/tests/hermes_cli/test_anon_challenge.pyindex f293df4680e..01e7d4d665c 100644--- a/tests/hermes_cli/test_anon_challenge.py+++ b/tests/hermes_cli/test_anon_challenge.py@@ -264,6 +264,12 @@ class TestOtherEndpointsAreUnchanged:anon_auth.ensure_portal_identity(explicit=True)assert exc.value.code == anon_auth.ANON_POW_REQUIRED+ def test_a_proof_of_work_verdict_off_428_stays_the_proof_of_work_verdict(self, nas):+ nas.create_response = httpx.Response(400, json={"error": "pow_invalid"})+ with pytest.raises(anon_auth.AuthError) as exc:+ anon_auth.ensure_portal_identity(explicit=True)+ assert exc.value.code == anon_auth.ANON_POW_REQUIRED and exc.value.retryable is False+def test_a_403_on_sign_up_stays_retryable(self, nas):nas.create_response = httpx.Response(403, json={"error": "access_denied"})with pytest.raises(anon_auth.AuthError) as exc: