Repository navigation
test(server): retry the Reserve ingress fixture's start on a port collision - #8659
Conversation
…lision test 1/5 of dev batch 43369456647 (self-hosted lidge-ocx-07) failed "responses gpt-reserve: public localhost traffic stays public" with EADDRINUSE: the fixture probes two free ports with findAvailablePort and binds them later in startServer, and on a shared runner another process took the probed port in between. Pick fresh ports and start again, up to three attempts, only when the start fails on an address-in-use bind (including the loopback listener's), as the CLI's own start retries isAddrInUse. A scratch test holding the probed public port open fails with EADDRINUSE on the old fixture and passes on this one.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…ries Review of #8659: a start whose loopback bind fails has already started the public listener, and its stop and ledger-lease release settle asynchronously. Await waitForFailedStartRollback before retrying or rethrowing, as the CLI's start does, and report a rollback that does not settle together with the original error. Adds reserve-ingress-fixture-port-race.test.ts: a public collision and a loopback-listener collision are probed again and start, and a collision on every attempt fails after three starts with the bind error. All three fail on dev's fixture and pass here.
… uncertain Second review of #8659: when the rollback rejects, the fixture's teardown removed the home anyway, and a failing teardown could replace the original error; the collision tests also passed without the rollback being awaited. The fixture now marks the rollback uncertain, keeps the home (named in the error) while still restoring process state, and reports a teardown failure together with the error that caused it. Two cases control the rollback: a slow one must settle before the next probe, and a rejecting one surfaces both errors and leaves the home in place. Dropping the await fails both; dropping the home guard fails the second.
|
Maintainer judgment (dev integration, MAINTAINERS.md maintainer-integration exception): merging without a second maintainer approval, as part of the DEV-RED repair for dev batch run 43369456647 (test 1/5 (self-hosted lidge-ocx-07)).
|
Summary
test 1/5of dev batch run 43369456647 ran on self-hostedlidge-ocx-07and failedtests/server/reserve-ingress.test.ts"responses gpt-reserve: public localhost traffic stays public; credential-bearing sibling stays local" withEADDRINUSEon port 39915.tests/helpers/reserve-ingress-fixture.ts(unchanged since September) probes two free ports withfindAvailablePortand binds them later instartServer. On a shared runner another process took the probed port in between, so this is a fixture flake with a known mechanism, not a dev regression.The fixture now picks fresh ports and starts again, up to three attempts, only when the start fails on an address-in-use bind (including the loopback listener's
AuxiliaryListenerBindError). This mirrors how the CLI's own start retriesisAddrInUseinsrc/cli/index.ts, andstartServeralready rolls back the public listener when the loopback bind fails. Before deciding to retry or rethrow, it awaitswaitForFailedStartRollback(error)as the CLI does, so a public listener started before a loopback collision has fully stopped. If that rollback rejects, the fixture keeps its home (the error names it) instead of deleting it from under a listener or lease that may still be live, and a teardown failure is reported together with the error that caused it. Any other start error still throws immediately. Test-only.tests/server/reserve-ingress-fixture-port-race.test.tscovers this deterministically: a public collision and a loopback-listener collision are probed again and start, a collision on every attempt fails after three starts with the bind error, a slow rollback must settle before the next probe, and a rejecting rollback surfaces both errors and keeps the home. Removing the rollbackawaitfails two of these cases, and removing the home guard fails one.Verification
bun test tests/server/reserve-ingress-fixture-port-race.test.ts: 5 pass on this branch; the original three fail on dev's fixture (0 pass, 3 fail). With the related ingress and layout files: 69 pass, 0 fail.EADDRINUSE. With this change: 1 pass.bun test tests/server/reserve-ingress.test.ts: 32 pass, 0 fail.bun test tests/server/caller-session-ingress.test.ts(the other user of the fixture): 3 pass, 0 fail.bun run typecheck: exit 0.Checklist
Summary by CodeRabbit