Skip to content

fix(agents-login): finalize Claude capture on parsed token (stuck-waiting bug)#731

Merged
ExtraToast merged 1 commit into
mainfrom
fix/credential-finalize-store
Jun 25, 2026
Merged

fix(agents-login): finalize Claude capture on parsed token (stuck-waiting bug)#731
ExtraToast merged 1 commit into
mainfrom
fix/credential-finalize-store

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

Symptom

After pasting the Claude auth code/redirect URL, the credentials page stuck forever on "Authorization submitted. Waiting for the session to finish." and nothing was ever stored.

Root cause

In the worker session lifecycle, Claude finalization (capture + POST to agents-api) only ran after a recognized success line or process exit. In production claude setup-token prints CLAUDE_CODE_OAUTH_TOKEN=... after paste-back while keeping the PTY open and without matching the success regex, so the session stayed awaiting_url indefinitely and never captured/posted. (Not an agents-api-side fault.)

Fix

After redirect submission, a parsed Claude OAuth token is now treated as the completion signal — the worker immediately finalizes, captures, and POSTs to agents-api, advancing the session to succeeded. Post-submission CLI failure output now transitions the session to failed (with a reason) instead of being swallowed into a hang.

Tests

Failing-first regression test added: after redirect submission a fake setup-token emits the token without exiting/printing a success phrase — failed with expected 'awaiting_url' to be 'succeeded' before the fix, passes after. Full suite: 79 tests + typecheck + lint pass.

…success line

claude setup-token prints the OAuth token after the redirect URL is
pasted but can keep the PTY open without printing a recognized success
line, so the session stayed awaiting_url forever and never captured or
POSTed to agents-api. The worker now treats a parsed Claude OAuth token
as the completion signal and immediately finalizes, captures, and posts;
post-submission CLI failure output now transitions the session to failed
instead of being ignored. Adds a regression test.
@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 3f28055 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