Skip to content

fix(agents-login): submit the pasted code with a separate Enter keystroke#735

Merged
ExtraToast merged 1 commit into
mainfrom
fix/credential-enter-keystroke
Jun 25, 2026
Merged

fix(agents-login): submit the pasted code with a separate Enter keystroke#735
ExtraToast merged 1 commit into
mainfrom
fix/credential-enter-keystroke

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

Root cause (from prod PTY logs)

After the prior fixes, the worker now writes the code (worker PTY stdin write) and claude setup-token echoes it as masked asterisks — but it never submits (no token, no error, no exit). setup-token is an Ink TUI with bracketed-paste mode (\x1b[?2004h); a bulk code\r write is treated as a paste, so the trailing \r is swallowed instead of acting as Enter.

Fix

Write the authorization code, then send \r as a separate, slightly-delayed write so Ink registers it as a submit keypress; retry the Enter once if there's no completion shortly after. Timers are cleared on finalize/failure/cancel. Callback-URL code extraction, credentials-file fallback, token parsing, and the bounded redirect timeout are unchanged.

Tests

Focused fake-PTY test asserts the write sequence is [code, '\r'] (two distinct writes) and that a parsed token is posted to agents-api and the session reaches succeeded. Suite 91 tests + typecheck + lint pass.

…ode submits

The code was reaching the CLI (it echoed masked asterisks) but never
submitted: claude setup-token is an Ink TUI with bracketed-paste mode,
which treats a bulk 'code\r' write as a paste and swallows the trailing
carriage return, so Enter never fired.

- Write the authorization code, then send '\r' as a SEPARATE, slightly
  delayed write so Ink registers it as a submit keypress; retry the
  Enter once if no completion shortly after.
- Clears the submit/retry timers on finalize/failure/cancel.
- Keeps callback-URL code extraction, credentials-file fallback, token
  parsing, and the bounded redirect timeout.
@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 e6264f3 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