Skip to content

test(desktop): two-account callback test uses two distinct ports - #37271

Merged
t3dotgg merged 1 commit into
mainfrom
test/desktop-codex-callback-distinct-ports
Nov 15, 2026
Merged

t3dotgg merged 1 commit into
mainfrom
test/desktop-codex-callback-distinct-ports

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Nov 15, 2026

Copy link
Copy Markdown
Member

Problem

CodexAuthCallback.test.ts > allows two accounts to complete independently failed in CI on two unrelated branches (#37039, #28839) with "The ChatGPT callback port is in use on this computer". The test called freePort() twice in a row. freePort() binds port 0, reads the port, and closes the socket, so the kernel can return the same port on the next call. The second sign-in listener then fails with EADDRINUSE. On Linux, 5 of 20,000 back-to-back bind/close pairs returned the same port.

Change

New freePorts(count) holds every probe socket open until all ports are read, then closes them. The two-account test uses freePorts(2). freePort() now calls freePorts(1). Test-only.

Scope

CI flake fix, test-only. No issue: the CI runs above show the failure, and the cause is visible in the test helper.

Verification

  • Old code with freePort() forced to return the same port twice: fails 3/3 with the CI error.
  • Fixed file: 5/5 runs pass (4 tests each).
  • vp run check:changed: format, lint, knip, typecheck, and test pass.
  • Not checked: the general window between closing a probe socket and the product listening, where another process could take the port. Every test in this file has that window, and it is much rarer.

Reviewed with sol-loop: 1 pass with GPT-6.1 Sol. Sol verdict: approved

Made by Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

freePort() closed its probe socket before the next call, so two calls in a row
could return the same port and the second listener failed with "port is in use".
freePorts(2) holds both probe sockets until both ports are read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 15, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 34ab586

Macroscope's review found this PR approvable — All changes are confined to repository-ignored paths and were assessed on that basis without reconstructing excluded contents. The supplied context identifies no material risk requiring human judgment.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@t3dotgg
t3dotgg merged commit ed7f069 into main Nov 15, 2026
34 checks passed
@t3dotgg
t3dotgg deleted the test/desktop-codex-callback-distinct-ports branch November 15, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant