fix: handle slow_down in GitHub device-flow token polling#1344
Open
friendlygeorge wants to merge 1 commit into
Open
fix: handle slow_down in GitHub device-flow token polling#1344friendlygeorge wants to merge 1 commit into
friendlygeorge wants to merge 1 commit into
Conversation
Per RFC 8628 §3.5, slow_down is not a terminal error. The client must increase its polling interval by 5 seconds and continue. Previously, slow_down was treated as a fatal error, causing login to fail with "token request failed: slow_down" and forcing the user to restart. This commit treats slow_down the same as authorization_pending but with the required interval increase.
Author
|
Hi! This PR has been open for 5 days. Just checking if there's anything I can do to help move it forward — happy to address any review feedback or make adjustments. The fix handles the |
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
Treat
slow_downas a retriable error in the GitHub device-flow token polling loop, per RFC 8628 §3.5.Problem
When GitHub's device-flow token endpoint returns
slow_down, the publisher exits with a fatal error:The login session is unrecoverable — the user must re-run the command and hope to authorize before any
slow_downis emitted again.Root Cause
In
pollForToken, onlyauthorization_pendingis treated as retriable.slow_downfalls into the catch-all error branch and aborts:Fix
Treat
slow_downthe same asauthorization_pendingbut with the required interval increase (+5 seconds):Testing
The existing test infrastructure doesn't directly test
pollForToken(unexported method, external test package). The fix is minimal (4 lines changed) and follows the exact pattern specified in RFC 8628 §3.5. Can verify manually:mcp-publisher login githubRelated
slow_downas fatal instead of backing off #1289