The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(anon): retry_after is the whole wait, not the wait plus float dust
kshitijk4poor6ff1a6c8a21a
diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.pyindex 9cb4201be07..e0cf14fc65f 100644--- a/hermes_cli/anon_auth.py+++ b/hermes_cli/anon_auth.py@@ -405,7 +405,9 @@ class MintFailure:attempts: int = 1def remaining(self) -> float:- return 0.0 if not self.retryable else max(0.0, self.not_before - time.monotonic())+ # Rounded to the millisecond: ``(now + wait) - now`` is not exactly ``wait`` in floating point,+ # and the ceil below turned that dust into an extra whole second ("retry in 61s").+ return 0.0 if not self.retryable else max(0.0, round(self.not_before - time.monotonic(), 3))def as_payload(self) -> Dict[str, Any]:"""The wire shape every status RPC carries: ``{error_code, error, retryable, retry_after}``diff --git a/tests/hermes_cli/test_anon_failure_modes.py b/tests/hermes_cli/test_anon_failure_modes.pyindex 0d14c51d397..2cdab8fec01 100644--- a/tests/hermes_cli/test_anon_failure_modes.py+++ b/tests/hermes_cli/test_anon_failure_modes.py@@ -340,3 +340,12 @@ def test_extra_welcome_hosts_make_a_local_stand_in_the_welcome_host(monkeypatch)])def test_friendly_wait_never_prints_raw_seconds(seconds, expected):assert anon_auth.friendly_wait(seconds) == expected+++def test_retry_after_is_the_whole_wait_not_the_wait_plus_float_dust(monkeypatch):+ """``(now + 60) - now`` is 60.000000000000455 for this ``now``; the payload must still say 60."""+ now = 4064.78551427515 + 16.0+ monkeypatch.setattr(anon_auth.time, "monotonic", lambda: now)+ failure = anon_auth.MintFailure(code=anon_auth.ANON_SERVER_ERROR, message="x", retryable=True,+ retry_after=60.0, not_before=now + 60.0)+ assert failure.as_payload()["retry_after"] == 60