Skip to content

fix(agents-login): detect the ANSI-fused Claude login chooser/REPL#741

Merged
ExtraToast merged 1 commit into
mainfrom
fix/agents-login-chooser-detect-ansi-fused
Jun 26, 2026
Merged

fix(agents-login): detect the ANSI-fused Claude login chooser/REPL#741
ExtraToast merged 1 commit into
mainfrom
fix/agents-login-chooser-detect-ansi-fused

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

Problem (live from worker logs)

After #740, Claude login still hung at starting. The new /login fallback fires and the CLI shows the "Select login method" chooser (option 1 "Claude account with subscription" highlighted), but the worker never pressed Enter to confirm it → stall.

Cause: the TUI draws that menu with ANSI cursor-column moves (ESC[NNG) instead of spaces, so stripAnsi() fuses the words → Selectloginmethod:❯1.Claudeaccountwithsubscription. The detectors used \s+ (requires whitespace) and never matched the fused text. Verified against the real bytes: old \s+ → false, fixed \s* → true. (forceLoginMethod=claudeai does not auto-skip the chooser on claude v2.1.186, so confirming it is required.)

Fix

detectClaudeLoginChooser and detectClaudeLoggedOutRepl are now whitespace-insensitive (\s*), matching both the spaced and the ANSI-fused forms. Added regression tests that feed real cursor-column bytes (these fail on the old \s+).

Tests

npm test: 102 pass, branch coverage 83.52% (≥80%). Lint clean.

🤖 Generated with Claude Code

…s* not \s+)

Claude login still hung at "starting": after /login the CLI shows the
"Select login method" chooser, but the worker never pressed Enter to confirm
it. The TUI renders that menu with ANSI cursor-column moves (ESC[NNG) instead
of spaces, so stripAnsi() fuses the words ("Selectloginmethod",
"Claudeaccountwithsubscription"). The detector regexes used \s+ (requires
whitespace) and never matched the fused text -> no chooser Enter -> stall.
(forceLoginMethod=claudeai does not auto-skip the chooser on claude 2.1.186.)

Make detectClaudeLoginChooser and detectClaudeLoggedOutRepl whitespace-
insensitive (\s*), matching both spaced and fused forms. Add regression tests
that feed real ANSI cursor-column bytes (fail on the old \s+ patterns).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ExtraToast ExtraToast merged commit d116f8d into main Jun 26, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant