fix(agents-login): widen Claude login PTY so the authorize URL keeps its state param#743
Merged
Merged
Conversation
…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>
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
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). Atcols=400the CLI wrapped the URL, putting&state=...on the next line; the URL parser's[^\s]+stops at the line break, so the captured URL droppedstate.Fix
Widen the login PTY to
cols=2000so the URL + itsstatetail stays on one line. Verified live against claude 2.1.186 in-cluster: at cols=2000 the parser captures the full 450-char URL withHAS_STATE=true.Tests
fakeSpawnernow records spawn options; a regression test asserts the Claude PTY is spawned withcols >= 1000.npm test: 103 pass, branch 83.52%.🤖 Generated with Claude Code