Repository navigation
fix: device login polling bails on unrecognized error codes - #44
Merged
Merged
Conversation
The device flow polling treated unknown/transient error codes as fatal
and aborted immediately instead of continuing to poll.
Two fixes:
1. Handle OAuth standard error format {"error": "string_code"}
in addition to OpenAI's nested {"error": {"code": "..."}}
2. Make the catch-all branch continue polling instead of bailing,
logging the error at debug level for diagnostics
This prevents the device login from failing with 'Device token error'
after a single poll when the API returns a new or unknown error code.
Owner
|
Thanks for the fix. The diagnosis was right: device-code polling can return the OAuth standard error format {"error":"authorization_pending"}, and the old code treated it as fatal instead of continuing to poll. I merged PR #44 to preserve the contribution, then followed up on dev with a tested version that also covers OpenAI nested error responses, slow_down handling, and retrying unknown transient polling errors. This will be called out in the 0.0.21 release notes. Thanks again for catching and contributing the fix. |
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.
The device flow polling (
login --device) treated unknown/transient error codes as fatal and aborted immediately after a single poll, instead of continuing to poll.Problem:
codex-switch login --devicefails withDevice token error: ...after one pollFix (2 changes):
Handle OAuth standard error format —
{"error": "string_code", "error_description": "..."}in addition to OpenAI's nested{"error": {"code": "...", "message": "..."}}Make catch-all continue polling — instead of bailing on unrecognized error codes, log at debug level and keep polling until timeout (15 min). Transient API responses shouldn't abort the entire flow.
Tested: Device login on Linux headless server now polls correctly until user completes browser authorization.