Skip to content

fix(minimax-oauth): handle expired_in as Unix-ms timestamp, not seconds duration - #22023

Closed
algojogacor wants to merge 2 commits into
NousResearch:mainfrom
algojogacor:fix-minimax-oauth-expired-in
Closed

fix(minimax-oauth): handle expired_in as Unix-ms timestamp, not seconds duration#22023
algojogacor wants to merge 2 commits into
NousResearch:mainfrom
algojogacor:fix-minimax-oauth-expired-in

Conversation

@algojogacor

Copy link
Copy Markdown

Summary

MiniMax OAuth login fails with year 58382 is out of range because the expired_in field is treated as a seconds-duration when MiniMax actually returns it as a Unix-millisecond timestamp.

Root Cause

Both _minimax_oauth_login and _refresh_minimax_oauth_state apply now + expired_in directly, treating the value as a seconds offset. When MiniMax returns a millisecond timestamp (~1.75e12), the resulting date is absurdly far in the future (>58000 CE).

Fix

Applies the same defensive heuristic already used by _minimax_poll_token (lines 4753-4762):

  • If expired_in > now_ms // 2 → treat as absolute Unix-ms timestamp, compute remaining seconds
  • Otherwise → treat as seconds duration from now

Applied at both sites:

  1. _minimax_oauth_login (line 4876)
  2. _refresh_minimax_oauth_state (line 4952)

Testing

The existing refresh test passes expired_in: 7200 (a duration), which hits the else branch and produces the same expires_in: 7200 as before.

Fixes: #22020

…_images

document.images is unreliable on SPA and JavaScript-heavy pages,
causing 'SyntaxError: Unexpected end of input' when the eval bridge
processes expressions that rely on it.

Change to document.querySelectorAll('img') which returns a static
NodeList that Array.from can reliably convert. Also wrapped in an
IIFE to match the working workaround pattern from browser_console.

Fixes: #22012
Closes: #22012
MiniMax returns expired_in as a Unix-millisecond timestamp,
not a seconds duration. This caused 'year 58382 is out of range'
errors when the raw value was treated as seconds.

Apply the same defensive heuristic already used by
_minimax_poll_token at both OAuth login and refresh sites.

Fixes: #22020
@algojogacor algojogacor closed this May 9, 2026
@algojogacor
algojogacor deleted the fix-minimax-oauth-expired-in branch May 9, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant