test(ai): wait for the manual OAuth prompt before aborting the login - #1323
Merged
Conversation
The abort raced a setTimeout(0) against the login opening its manual prompt and then judged the outcome with a 500 ms timer; loaded CI runners opened the prompt late and reported 'still pending'. Resolve an explicit signal from the prompt callback, await it, then abort and assert the settled rejection.
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.
Summary
packages/ai/test/anthropic-oauth.test.ts"aborts a manual-only login while the manual prompt is still open" raced asetTimeout(0)against the login opening its manual prompt, then decided the outcome with a 500 ms timer. On loaded runners the prompt opened after the abort and the test reportedstill pending. It failed four separate PR runs today (#1318, #1320, #1308, #1267), each unrelated to the diff under test.Changes
openedpromise; the test awaits that signal, aborts, and asserts the settled outcome directly. No timers, no race.QA & Evidence
CI=1on a bunshin machine (mengmotaMac): 8/8 passed each time (/tmp/ulw-sdk-20260903/flake-green.log).Related
Test (workspaces + scripts)reruns on fix(claude-sdk-oauth): never resume an SDK session id that init never confirmed #1318 / fix(claude-sdk-oauth): state host-tool denial as a fact, not an instruction #1320 / fix(auth): preserve legacy OAuth credential when adding accounts #1308 / fix(claude-sdk-oauth): preserve restart continuity after compaction #1267 today.Summary by cubic
Fixes the flaky Anthropic OAuth abort test by replacing timer-based racing with an explicit prompt-opened signal. The old test used a
setTimeout(0)and a 500 msPromise.race, which failed on loaded CI runners when the prompt opened after the abort. Now the prompt callback resolves anopenedpromise, the test awaits it, aborts, and asserts the settled outcome directly.Written for commit 32fc0d4. Summary will update on new commits.