fix(auth): handle MiniMax OAuth epoch-ms expiries#22240
Closed
LeonSGP43 wants to merge 1 commit into
Closed
Conversation
Collaborator
19 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MiniMax/OpenClaw OAuth failures caused by treating expired_in as always being a TTL (seconds) when it can be an epoch-milliseconds timestamp, which previously produced invalid far-future datetimes and immediate post-approval login failures.
Changes:
- Added
_minimax_parse_expired_in()helper to normalizeexpired_ininto(expires_at_epoch_seconds, ttl_seconds). - Reused the helper in
_minimax_poll_token(),_minimax_oauth_login(), and_refresh_minimax_oauth_state()to prevent overflow/invalid datetime conversions. - Added regression tests covering both login and refresh flows when
expired_inis epoch-ms.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
hermes_cli/auth.py |
Introduces a shared expired_in parser and applies it across MiniMax OAuth polling/login/refresh to correctly handle epoch-ms expiries. |
tests/test_minimax_oauth.py |
Adds regression tests ensuring login/refresh accept epoch-ms expired_in and produce reasonable expires_at / expires_in values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix MiniMax OAuth flows that persist
expired_inas if it were always a TTL in seconds. MiniMax can return a unix-ms expiry timestamp instead, which made Hermes compute impossible dates like year 58381 and fail immediately after browser approval.Changes
_minimax_parse_expired_in()to normalize MiniMax/OpenClawexpired_invalues from either unix-ms epoch or TTL seconds_minimax_poll_token(),_minimax_oauth_login(), and_refresh_minimax_oauth_state()expired_inis an epoch-ms timestampFixes #21779.
Verification
uv sync --frozen --extra allgit diff --check./scripts/run_tests.sh tests/test_minimax_oauth.py -quv run --frozen ruff check .lint-diffsemantics onhermes_cli/auth.pyandtests/test_minimax_oauth.pyenv -irepo smoke:pytest tests/ --collect-only -q --ignore=tests/integration --ignore=tests/e2e -n auto