Skip to content

fix(agents-login): paste the auth code, not the full URL, into setup-token#733

Merged
ExtraToast merged 1 commit into
mainfrom
fix/credential-paste-code
Jun 25, 2026
Merged

fix(agents-login): paste the auth code, not the full URL, into setup-token#733
ExtraToast merged 1 commit into
mainfrom
fix/credential-paste-code

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

Root cause (from the new redacted logging)

The worker timed out with output_tail=…Paste code here if prompted >. claude setup-token was 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

  • Extract the code from callback URLs (…/oauth/code/callback?code=…&state=…); bare codes pass through unchanged.
  • Write <code>\r to the PTY only after the paste prompt appears; guard against double submission.
  • Keeps the parsed-token / credentials-file completion + bounded timeout→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.

…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.
@ExtraToast ExtraToast added the bug Something isn't working label Jun 25, 2026
@ExtraToast ExtraToast self-assigned this Jun 25, 2026
@ExtraToast ExtraToast merged commit c613ddd into main Jun 25, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant