Skip to content

test(ai): wait for the manual OAuth prompt before aborting the login - #1323

Merged
code-yeongyu merged 1 commit into
mainfrom
test/anthropic-oauth-abort-deterministic
Sep 3, 2026
Merged

test(ai): wait for the manual OAuth prompt before aborting the login#1323
code-yeongyu merged 1 commit into
mainfrom
test/anthropic-oauth-abort-deterministic

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

packages/ai/test/anthropic-oauth.test.ts "aborts a manual-only login while the manual prompt is still open" raced a setTimeout(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 reported still pending. It failed four separate PR runs today (#1318, #1320, #1308, #1267), each unrelated to the diff under test.

Changes

  • The prompt callback now resolves an explicit opened promise; the test awaits that signal, aborts, and asserts the settled outcome directly. No timers, no race.

QA & Evidence

  • Ran the file five times in a row under CI=1 on a bunshin machine (mengmotaMac): 8/8 passed each time (/tmp/ulw-sdk-20260903/flake-green.log).
  • Test-only change: no runtime source touched, so no CHANGELOG/changes.md entry (gate exempts tests).

Related


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 ms Promise.race, which failed on loaded CI runners when the prompt opened after the abort. Now the prompt callback resolves an opened promise, the test awaits it, aborts, and asserts the settled outcome directly.

  • Test-only change, no runtime source touched, so no changelog entry is needed.

Written for commit 32fc0d4. Summary will update on new commits.

Review in cubic

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.
@code-yeongyu
code-yeongyu merged commit 531aa56 into main Sep 3, 2026
23 checks passed
@code-yeongyu
code-yeongyu deleted the test/anthropic-oauth-abort-deterministic branch September 3, 2026 07:52
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