Repository navigation
Conversation
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
Concurrent SDK calls using expired OAuth credentials each call
ensureFreshToken()independently. They can submit the same refresh token multiple times before any caller saves the replacement. With refresh-token rotation, callers can fail authentication even though another request successfully refreshed the session.The regression uses two public
MiniMaxSDKinstances and four concurrent speech/image calls against a loopback fixture that accepts a refresh token once. On unchanged main, only one call succeeds; after this patch, all four succeed with one refresh request. This models token rotation locally, not a claim of live MiniMax service verification.Change
Related to the refresh race described in #79, but deliberately limited to automatic refreshes within one process. It does not fix races between separate CLI processes or coordinate the manual
auth refreshcommand. Existing request/retry behavior is unchanged.Verification
test/sdk/speech.test.ts.Full runs use temporary configuration, a validation-only preload rejecting external fetches by default (test mocks can replace fetch), and a process-local no-op URL opener. No live model requests or real credentials were used.
Developed with OpenAI Codex assistance, including local reproduction, regression tests and independent automated blind reviews. This is not human review or live-service validation.
Need help on this PR? Tag
@codesmith-botwith what you need.