fix: handle MiniMax OAuth expired_in as ms timestamp, not seconds duration#22020
Closed
mzig7 wants to merge 1 commit into
Closed
fix: handle MiniMax OAuth expired_in as ms timestamp, not seconds duration#22020mzig7 wants to merge 1 commit into
mzig7 wants to merge 1 commit into
Conversation
…ation MiniMax OAuth token endpoint returns expired_in as a Unix millisecond timestamp (matching the code-endpoint behavior already handled in _minimax_poll_token), but both _minimax_oauth_login and _refresh_minimax_oauth_state treated it as a seconds duration and added it to the current time — producing an out-of-range date (year 58382) that crashed the login flow. Applies the same defensive-heuristic parsing used by _minimax_poll_token: if expired_in exceeds half the current ms epoch, treat it as an absolute ms timestamp; otherwise treat it as a seconds duration.
Collaborator
19 tasks
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.
Problem
MiniMax OAuth login fails with
year 58382 is out of range. Both_minimax_oauth_loginand_refresh_minimax_oauth_statetreat MiniMax'sexpired_infield as a seconds-duration and add it to the current time — but MiniMax returns it as a Unix millisecond timestamp, producing an absurdly large date.Fix
Applies the same defensive-heuristic parsing already used by
_minimax_poll_token(line 4753-4762):expired_in > now_ms // 2, treat it as an absolute Unix ms timestampAlso fixes
expires_inin the stored state to be computed from the resolved expiry, rather than storing the raw (potentially ms-timestamp) value.Changes
hermes_cli/auth.py— 2 sites:_minimax_oauth_loginand_refresh_minimax_oauth_stateTests
tests/test_minimax_oauth.py— 15/15 pass unchanged. The refresh test passesexpired_in: 7200(a duration), which hits the else branch and produces the sameexpires_in: 7200as before.