Repository navigation
fix(ci): prevent idle gateway fixture port collisions - #140747
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 6, 2026, 11:58 PM ET / September 7, 2026, 03:58 UTC. ClawSweeper reviewWhat this changesReserve automatically selected Gateway test ports during preparation and stopped phases, with socket cleanup and regression coverage for failures and restarts. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this is a useful, bounded fixture repair absent from current main and the latest release. No actionable introduced defect was found. The maintainer-authored PR also remains protected from automatic closure. Priority: P2 Review scores
Verification
How this fits togetherThe shared Gateway test helper creates isolated state and launches processes used by integration and CI proofs. Its port and process lifecycle determines whether parallel fixtures can run without interfering with each other. flowchart TD
A[Test requests an instance] --> B{Caller supplies port?}
B -->|Yes| C[Caller owns port]
B -->|No| D[Reserve idle loopback port]
D --> E[Release socket and launch Gateway]
C --> E
E --> F[Verify child teardown]
F -->|Reusable instance| D
F -->|Terminal cleanup| G[Release resources and state]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +230. Total +230 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep idle-port ownership in the shared fixture lifecycle and retain the broader collision issue until its concurrent execution is verified. Do we have a high-confidence way to reproduce the issue? Yes for the idle-port gap: current source releases the listener before preparation, allowing a competing listener to bind. This review did not execute that path or reproduce the original concurrent SQLite/Discord sequence. Is this the best way to solve the issue? Yes. Holding the reservation in the existing fixture owner is a focused repair that preserves explicit-port ownership, teardown checks, retry limits, and CI parallelism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against de0b6849e19e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
The remaining handoff risk is pre-existing and was explicitly accepted in the bounded implementation review: repair the long idle ownership gaps while retaining #140632 for controlled concurrent verification. This PR does not claim complete race elimination or close that issue. The PR body now records that disposition explicitly. The matching-artifact SQLite lifecycle test and all three hosted test-typecheck jobs have passed at |
|
Merged via squash.
|
Related: #140632
What Problem This Solves
Resolves a problem where parallel CI fixtures could claim an isolated Gateway's automatically selected port while that Gateway was being prepared, stopped for Doctor work, or restarted after a startup refusal.
Why This Change Was Made
The test instance now reserves its automatically allocated loopback port throughout idle phases, releases it immediately before spawning, and reacquires the same port only after verified child teardown. Terminal cleanup releases the reservation independently of process cleanup and never reopens it. Acquisition rollback preserves the original failure while still attempting both state and socket cleanup.
Caller-supplied ports remain caller-owned. Existing convergence retries, deadlines, process ownership checks, runtime storage behavior, and CI parallelism are unchanged. The release-to-child-bind handoff is still non-atomic; this closes long idle ownership gaps, not every possible port race.
Review disposition: the remaining handoff race predates this patch. The selected mitigation is to repair idle ownership now and retain the broader collision issue for controlled concurrent verification. This is the bounded maintainer-reviewed scope, not a claim of complete race elimination.
User Impact
More reliable parallel Gateway lifecycle proofs without serializing CI or masking startup failures. No end-user runtime behavior changes.
Evidence
RUN_SQLITE_SESSION_LIFECYCLE=true, with the unchanged built-CLI test passing in 34.1 seconds. No local build was substituted.8d9052c5697caab0847b48a4777b3fede1300970. The draft-only skipped run is not used as evidence.The linked issue stays open: the original concurrent SQLite/Discord collision sequence has not been reproduced end to end.