fix(agents-login): paste the auth code, not the full URL, into setup-token#733
Merged
Conversation
…token claude setup-token sits at 'Paste code here if prompted >' expecting the authorization code, but the worker wrote the entire OAuth callback URL, so the CLI never advanced and capture timed out. - Extract the code from callback URLs (…/oauth/code/callback?code=…&state=…); bare codes pass through unchanged. - Write '<code>\r' only once the paste prompt has appeared; guard against double submission. - Keep the parsed-token / credentials-file completion + bounded timeout->failed behavior.
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.
Root cause (from the new redacted logging)
The worker timed out with
output_tail=…Paste code here if prompted >.claude setup-tokenwas waiting at its paste prompt for the authorization code, but the worker wrote the entire OAuth callback URL the user pasted, so the CLI never advanced and capture timed out.Fix
codefrom callback URLs (…/oauth/code/callback?code=…&state=…); bare codes pass through unchanged.<code>\rto the PTY only after the paste prompt appears; guard against double submission.failed(redacted tail) from the prior change.Tests
Surgical: redirect-URL→extracted-code PTY write + completion, and bare-code passthrough (+ PTY integration). Suite 89 tests + typecheck + lint pass.