Skip to content

Stabilize websocket test server binding#14002

Merged
aibrahim-oai merged 2 commits intomainfrom
codex/flaky-test-stabilization-missing-websocket
Mar 10, 2026
Merged

Stabilize websocket test server binding#14002
aibrahim-oai merged 2 commits intomainfrom
codex/flaky-test-stabilization-missing-websocket

Conversation

@aibrahim-oai
Copy link
Collaborator

Summary

  • stop reserving a localhost port in the websocket tests before spawning the server
  • let the app-server bind 127.0.0.1:0 itself and read back the actual bound websocket address from stderr
  • update the websocket test helpers and callers to use the discovered address

Why this fixes the flake

The previous harness reserved a port in the test process, dropped it, and then asked the server process to bind that same address. On busy runners there is a race between releasing the reservation and the child process rebinding it, which can produce sporadic startup failures. Binding to port 0 inside the server removes that race entirely, and waiting for the server to report the real bound address makes the tests connect only after the listener is actually ready.

@aibrahim-oai aibrahim-oai requested a review from maxj-oai March 8, 2026 21:06
@aibrahim-oai aibrahim-oai force-pushed the codex/flaky-test-stabilization-missing-websocket branch from 41aa2ff to 93441b0 Compare March 10, 2026 05:38
@aibrahim-oai aibrahim-oai merged commit b39ae95 into main Mar 10, 2026
31 checks passed
@aibrahim-oai aibrahim-oai deleted the codex/flaky-test-stabilization-missing-websocket branch March 10, 2026 06:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant