Skip to content

fix(agents-login): widen Claude login PTY so the authorize URL keeps its state param#743

Merged
ExtraToast merged 1 commit into
mainfrom
fix/agents-login-pty-width-state-param
Jun 26, 2026
Merged

fix(agents-login): widen Claude login PTY so the authorize URL keeps its state param#743
ExtraToast merged 1 commit into
mainfrom
fix/agents-login-pty-width-state-param

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

Problem

Claude sign-in now reaches the authorize URL, but the URL handed to the user was missing &state → claude.ai: "Invalid OAuth Request: Missing state parameter."

Root cause (from live worker logs): the subscription authorize URL is ~450 chars (full scope set org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload + code_challenge + state). At cols=400 the CLI wrapped the URL, putting &state=... on the next line; the URL parser's [^\s]+ stops at the line break, so the captured URL dropped state.

Fix

Widen the login PTY to cols=2000 so the URL + its state tail stays on one line. Verified live against claude 2.1.186 in-cluster: at cols=2000 the parser captures the full 450-char URL with HAS_STATE=true.

Tests

fakeSpawner now records spawn options; a regression test asserts the Claude PTY is spawned with cols >= 1000. npm test: 103 pass, branch 83.52%.

🤖 Generated with Claude Code

…its state param

The Claude subscription authorize URL is ~450 chars (full scope set +
code_challenge + state). At cols=400 the CLI wrapped it, putting `&state=...`
on the next line; the URL parser's [^\s]+ stops at the break, so the captured
URL lacked `state` and claude.ai rejected it with "Invalid OAuth Request:
Missing state parameter".

Widen the login PTY to cols=2000 so the URL (and its state tail) stays on one
line. Verified live against claude 2.1.186: cols=2000 yields the full 450-char
URL with state present.

Test: fakeSpawner now records spawn options; a regression test asserts the
Claude PTY is spawned with cols >= 1000.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ExtraToast ExtraToast merged commit 9903822 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