Repository navigation
ChatGPT login: read the device code's interval as a number or a numeric string - #302
Merged
Merged
Conversation
…ic string OpenAI's device code endpoint now answers `"interval": "5"` instead of `5`, so reading it as u64 failed and "Sign in on another device" stopped at "The answer to the device code request could not be read: invalid type: string \"5\", expected u64". A new `tw_gateway::lenient::seconds` reads a non-negative integer or a string of digits; anything else counts as not given. It reads the device code's interval (unknown → 0, so polling uses its lower bound), `expires_in` in the ChatGPT and generic OAuth token answers, and Z.ai's `poll_interval_sec` and `expires_at`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
OpenAI's device code endpoint now answers
"interval": "5"instead of5. Reading it asu64failed, so Sign in on another device for a ChatGPT account stopped at The answer to the device code request could not be read: invalid type: string "5", expected u64 at line 4 column 17.tw_gateway::lenient::seconds: a non-negative integer or a string of digits (surrounding whitespace allowed); anything else is treated as not given.seconds_or_zerois the serde adapter.interval(unknown → 0, so polling falls back to its lower bound),expires_inin the ChatGPT token answer and the generic OAuth refresh answer, and Z.ai'spoll_interval_sec/expires_at— the same kind of field, so the same change in format doesn't break those logins either."5",5, missing and garbage.Checks:
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test --workspace(3081 passed).🤖 Generated with Claude Code