fix: parse MiniMax OAuth expired_in as unix-ms timestamp not TTL seconds#21786
Closed
rexliu1912-star wants to merge 1 commit into
Closed
fix: parse MiniMax OAuth expired_in as unix-ms timestamp not TTL seconds#21786rexliu1912-star wants to merge 1 commit into
rexliu1912-star wants to merge 1 commit into
Conversation
MiniMax returns expired_in as a unix millisecond timestamp (absolute time), not a relative TTL in seconds. The old code treated it as seconds, causing datetime overflow (year ~58381) when computing expires_at. Also bump MINIMAX_OAUTH_REFRESH_SKEW_SECONDS from 60s to 86400s (1 day) so tokens are refreshed proactively before expiry.
Collaborator
Contributor
|
Closing as superseded by #24165. Triage notes (high confidence): Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen. (Bulk-closed during a CLI PR triage sweep.) |
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 returns
expired_inas a unix millisecond timestamp (absolute time, e.g.1746729600000), not a relative TTL in seconds.hermes_cli/auth.pywas treating it as seconds and adding it tonow.timestamp(), producing a timestamp in year ~58381, causing Python'sdatetimeto overflow with:Login failed: year 58381 is out of rangeFix
Login path (
_minimax_oauth_login, L4876): detect whetherexpired_in > 1_000_000_000_000(millisecond unix timestamp) and divide accordingly.Refresh path (
_refresh_minimax_oauth_state, L4960): same logic applied to the refresh response.Refresh skew bumped from 60s to 86400s (1 day) so tokens are refreshed proactively.
Testing
Manual:
hermes auth add minimax-oauthnow succeeds and stores correctexpires_at; auto-refresh fires 24h before expiry instead of 60s before.No test suite change required as this fixes a production-only edge case with real OAuth tokens.