hermes MiniMax OAuth login fails immediately after the user approves in the browser:
Login failed: year 58381 is out of range
Root cause
MiniMax's /oauth/token returns expired_in as a unix-ms timestamp (matching OpenClaw's Date.now() < expireTimeMs convention), not a TTL in seconds. _minimax_poll_token in hermes_cli/auth.py already documents and handles this defensively for the polling deadline, but the two call sites that persist the resulting auth state do not:
_minimax_oauth_login (~line 4876):
expires_in_s = int(token_data["expired_in"])
expires_at = now.timestamp() + expires_in_s
...
datetime.fromtimestamp(expires_at, tz=timezone.utc).isoformat()
_refresh_minimax_oauth_state (~line 4952): same pattern.
With expired_in ≈ 1.78e12 (ms) added to now.timestamp() (~1.78e9 s), fromtimestamp is called with ~1.78e12 → year ~58381 → OverflowError: year 58381 is out of range.
Suggested fix
Factor the existing defensive parsing in _minimax_poll_token into a helper and reuse it in both save paths. The module already imports time at the top, so no extra import shim is needed:
def _minimax_parse_expired_in(value):
"""Returns (expires_at_epoch_seconds, ttl_seconds).
OpenClaw treats `expired_in` as a unix-ms timestamp; fall back to
TTL-in-seconds if the value is too small to be an epoch.
"""
raw = int(value)
now_s = time.time()
if raw > int(now_s * 1000) // 2:
expires_at_s = raw / 1000.0
ttl_s = max(1, int(expires_at_s - now_s))
else:
ttl_s = max(1, raw)
expires_at_s = now_s + ttl_s
return expires_at_s, ttl_s
Then in _minimax_poll_token, _minimax_oauth_login, and _refresh_minimax_oauth_state:
# poll
deadline, _ = _minimax_parse_expired_in(expired_in)
# login + refresh
expires_at_s, expires_in_s = _minimax_parse_expired_in(token_data["expired_in"])
...
"expires_at": datetime.fromtimestamp(expires_at_s, tz=timezone.utc).isoformat(),
"expires_in": expires_in_s,
Repro
hermes → choose MiniMax (OAuth · minimax.io)
- Approve in the browser
- CLI prints
Login failed: year 58381 is out of range
Environment
- Hermes commit:
faa13e49f (docs(web): fix SearXNG env configuration)
- Python on Ubuntu 26.04
I've patched it locally and verified login completes — happy to send a PR.
hermesMiniMax OAuth login fails immediately after the user approves in the browser:Root cause
MiniMax's
/oauth/tokenreturnsexpired_inas a unix-ms timestamp (matching OpenClaw'sDate.now() < expireTimeMsconvention), not a TTL in seconds._minimax_poll_tokeninhermes_cli/auth.pyalready documents and handles this defensively for the polling deadline, but the two call sites that persist the resulting auth state do not:_minimax_oauth_login(~line 4876):_refresh_minimax_oauth_state(~line 4952): same pattern.With
expired_in ≈ 1.78e12(ms) added tonow.timestamp()(~1.78e9 s),fromtimestampis called with ~1.78e12 → year ~58381 →OverflowError: year 58381 is out of range.Suggested fix
Factor the existing defensive parsing in
_minimax_poll_tokeninto a helper and reuse it in both save paths. The module already importstimeat the top, so no extra import shim is needed:Then in
_minimax_poll_token,_minimax_oauth_login, and_refresh_minimax_oauth_state:Repro
hermes→ choose MiniMax (OAuth · minimax.io)Login failed: year 58381 is out of rangeEnvironment
faa13e49f(docs(web): fix SearXNG env configuration)I've patched it locally and verified login completes — happy to send a PR.