Shared login never completes: after submitting the code the dialog sits at Code sent. Waiting for setup-token to finish… until it times out.
Cause
submit_claude_token_code sent the code and\r in a single write. Claude Code's prompt treats a multi-byte chunk as a paste and swallows the \r inside it, so the code filled the prompt but was never submitted.
Reproduced against claude setup-token 2.1.283 under a real pty with a dummy code:
Write pattern
Result
code + \r in one write (old behaviour)
code masked in prompt, nothing submitted
code, then \r 20/50/150 ms later
submitted; CLI replies OAuth error: … Press Enter to retry
Fix
New type_code_then_enter: writes the code, flushes, waits SUBMIT_ENTER_DELAY (250 ms — headroom over the measured 20 ms for Docker exec socket coalescing), then writes \r on its own.
submit_claude_token_code now sends only the code; the flow presses Enter.
Test the_code_and_its_enter_are_separate_writes uses a write-recording AsyncWrite to assert two distinct writes separated by the delay.
Testing
cargo test --lib: 677 passed.
Not yet verified end-to-end with a real sign-in — please confirm the shared login completes on a preview build.
Note
2.1.283 now reports a refused code as Request failed with status code 400 rather than Invalid code. Rejection detection still works via the Press Enter to retry marker, but the user-facing "full code was not copied" message may be inaccurate for expired/reused codes. Left for a follow-up.
## Problem
Shared login never completes: after submitting the code the dialog sits at *Code sent. Waiting for setup-token to finish…* until it times out.
## Cause
`submit_claude_token_code` sent the code **and** `\r` in a single write. Claude Code's prompt treats a multi-byte chunk as a paste and swallows the `\r` inside it, so the code filled the prompt but was never submitted.
Reproduced against `claude setup-token` 2.1.283 under a real pty with a dummy code:
| Write pattern | Result |
|---|---|
| code + `\r` in one write (old behaviour) | code masked in prompt, nothing submitted |
| code, then `\r` 20/50/150 ms later | submitted; CLI replies `OAuth error: … Press Enter to retry` |
## Fix
- New `type_code_then_enter`: writes the code, flushes, waits `SUBMIT_ENTER_DELAY` (250 ms — headroom over the measured 20 ms for Docker exec socket coalescing), then writes `\r` on its own.
- `submit_claude_token_code` now sends only the code; the flow presses Enter.
- Test `the_code_and_its_enter_are_separate_writes` uses a write-recording `AsyncWrite` to assert two distinct writes separated by the delay.
## Testing
- `cargo test --lib`: 677 passed.
- Not yet verified end-to-end with a real sign-in — please confirm the shared login completes on a preview build.
## Note
2.1.283 now reports a refused code as `Request failed with status code 400` rather than `Invalid code`. Rejection detection still works via the `Press Enter to retry` marker, but the user-facing "full code was not copied" message may be inaccurate for expired/reused codes. Left for a follow-up.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The code and its Enter were sent to `claude setup-token` in one write.
Claude Code's prompt reads a multi-byte chunk as a paste and swallows a
`\r` inside it, so the code filled the prompt but was never submitted and
the flow sat at "Waiting for setup-token to finish" until the 15-minute
timeout.
Measured against 2.1.283 under a pty: joined write never submits; the
same code with Enter 20 ms later submits every time. Now the code is
written, then Enter follows 250 ms later as its own write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jknapp
merged commit 292fc907fb into main2026-09-27 13:29:30 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Shared login never completes: after submitting the code the dialog sits at Code sent. Waiting for setup-token to finish… until it times out.
Cause
submit_claude_token_codesent the code and\rin a single write. Claude Code's prompt treats a multi-byte chunk as a paste and swallows the\rinside it, so the code filled the prompt but was never submitted.Reproduced against
claude setup-token2.1.283 under a real pty with a dummy code:\rin one write (old behaviour)\r20/50/150 ms laterOAuth error: … Press Enter to retryFix
type_code_then_enter: writes the code, flushes, waitsSUBMIT_ENTER_DELAY(250 ms — headroom over the measured 20 ms for Docker exec socket coalescing), then writes\ron its own.submit_claude_token_codenow sends only the code; the flow presses Enter.the_code_and_its_enter_are_separate_writesuses a write-recordingAsyncWriteto assert two distinct writes separated by the delay.Testing
cargo test --lib: 677 passed.Note
2.1.283 now reports a refused code as
Request failed with status code 400rather thanInvalid code. Rejection detection still works via thePress Enter to retrymarker, but the user-facing "full code was not copied" message may be inaccurate for expired/reused codes. Left for a follow-up.🤖 Generated with Claude Code