fix(agents-login): make Claude subscription login reach the authorize URL reliably#740
Merged
Merged
Conversation
… URL reliably
Claude login sessions hung at phase "starting" forever. On claude 2.1.186,
stale state in the worker's persistent login HOME makes the CLI land on the
idle logged-out REPL ("Not logged in · Run /login") after the trust prompt
instead of auto-launching the claudeai login wizard. The blind Enter-through
then only submitted empty REPL prompts and never sent /login, so the authorize
URL never appeared.
- Start each Claude login from a clean home: remove stale ~/.claude and
~/.claude.json, then always (re)write the onboarding seed + the
forceLoginMethod=claudeai managed-settings. A clean home reliably reaches the
authorize URL (confirmed live against 2.1.186 in-cluster).
- Add a one-shot /login fallback: when the logged-out REPL is detected, send
`/login` (and stop the blind Enter-through). Add a one-shot Enter for the
"Select login method" chooser in case forceLoginMethod does not auto-select.
- Raise the onboarding Enter-through to 10 sends at 1000ms (screen count varies).
Codex path is unchanged. (Codex login fails separately due to broken IPv6
egress to auth.openai.com — tracked independently.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
After the claudeai-login switch, Claude credential sessions hung at phase
startingforever (UI: "Starting…"). Diagnosed from the worker logs + live probing againstclaudev2.1.186 in the cluster:On the worker's persistent login HOME (
/home/agent), leftover.claude/state makes the CLI land on the idle logged-out REPL ("Not logged in · Run /login") after the trust prompt, instead of auto-launching theclaudeailogin wizard. The blind Enter-through then only submitted empty REPL prompts and never sent/login, so the authorize URL never appeared.Confirmed live: from a clean home, claude reaches the authorize URL every time (scope includes
user:profile✓); from a stale home it sits on the REPL.Fix (Claude path only)
~/.claude+~/.claude.json, then always (re)write the onboarding seed and theforceLoginMethod=claudeaimanaged-settings./loginfallback: when the logged-out REPL is detected, send/loginonce (and stop the Enter-through). Plus a one-shot Enter for the "Select login method" chooser ifforceLoginMethoddoesn't auto-select.Codex path unchanged.
Tests
npm test(vitest --coverage): 102 tests pass, global branch coverage 83.52% (≥80%). New coverage for home-cleanup, the/loginfallback, chooser Enter, and the new detectors.🤖 Generated with Claude Code