Repository navigation
fix: avoid foreign-listener race in Gateway acquisition proof - #166930
Conversation
Forward-port the test-only fix from #166883 onto main. Observe the fixture-owned reservation while preserving cooperative port claims and real competing-listener coverage. Co-authored-by: RomneyDa <[email protected]>
|
🦞👀 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: needs maintainer review before merge. Reviewed October 8, 2026, 12:26 AM ET / 04:26 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch changes Gateway fixture validation to observe its own closed listener while exercising a competing TCP listener and preserving port-claim checks. Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains necessary on current main and has no actionable patch findings. The updated evidence satisfies the prior replay requirement; no additional review blocker remains. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherOpenClaw’s automated tests create isolated Gateway fixtures with TCP listeners and cooperative port claims. This acquisition test checks listener release, retained claims, and final cleanup. flowchart TD
A[Acquire isolated fixture] --> B[Reserve listener and port claims]
B --> C[Release owned listener]
C --> D[Bind competing listener]
D --> E[Verify owned listener stays closed]
E --> F[Verify both claims remain held]
F --> G[Clean up and reacquire claims]
Technical reviewBest possible solution: Keep listener identity separate from cooperative port ownership and retain the controlled competing-listener regression on main. Do we have a high-confidence way to reproduce the issue? Yes: a foreign listener makes the original TCP probe return busy after the fixture correctly releases its reservation. Source establishes the mechanism and the body reports a controlled failing-base run; this review did not execute it. Is this the best way to solve the issue? Yes: observing the owned server removes the incorrect listener-identity assumption while preserving stop, independent claim-retention, and cleanup coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ba5b60b0bc45. Provenance checked
TestingProof path: in-process harness. Added test files: 1. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +32. Total +32 across 1 file. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment History |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…aw#166930) Forward-port the test-only fix from openclaw#166883 onto main. Observe the fixture-owned reservation while preserving cooperative port claims and real competing-listener coverage. Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Related: #166883 (release-branch fix, now forward-ported to main).
What Problem This Solves
Fixes: Gateway acquisition validation can fail after correct fixture cleanup when an unrelated listener occupies the released TCP port.
User Impact
User impact: no production or user-visible behavior changes. Automated validation now checks the fixture's own reservation rather than mistaking a foreign listener for its Gateway.
Why This Change Was Made
Forward-port the exact test-only fix from #166883 onto main. Observe the reserved server directly, exercise a real competing listener through stop, and preserve both independent cooperative port-claim checks and post-cleanup reacquisition. No runtime changes, retries, or timeout increases.
Evidence
Validated on main baseline
301e372903de4e9e04e17da018a1ac2ffdb4c2ffwith this patch:busyto befree. The fixture and listener were cleaned up; the control was removed afterward.pnpm test test/helpers/openclaw-test-instance.acquisition.test.ts --maxWorkers=1— 18 passed; 8.01 s wrapper wall time with cached compiled workers; changed scenario 37 ms.pnpm test src/test-utils/ports.test.ts --maxWorkers=1— 20 passed; 6.66 s wrapper wall time.node scripts/check-changed.mjs --timed --base 301e372903de4e9e04e17da018a1ac2ffdb4c2ff -- test/helpers/openclaw-test-instance.acquisition.test.ts— all 20 selected checks passed, including root-test typechecks, formatting, lint, and guards.git diff --checkpassed.a740fc28048a11e4ad411cd77ac2c3b11158a010).aa6157bee0b1da514ab0b1e4ac8753d53e56e3ff; all 46 jobs finished successfully or were intentionally skipped, andopenclaw/ci-gateis green. In the changed-test job, the changed scenario took 31 ms; its containing 13-file lane took 118.62 s (not per-file or incremental PR cost).Historical-shard replay qualification and recovery
The original failure was run 37706290335, job 113081546328. Its 56-file inventory is retained without omissions, partitioned into the current main owners: 53 tooling, two tooling-isolated, and one infra. This is a current-head replay of that inventory, not restoration of the older shared-worker topology.
An initial local selection stopped before the Gateway case on an unchanged security-workflow fixture (
install.jsonabsent). Diagnostics traced this to host Bash startup prepending/usr/binahead of the fixture's synthetic npm. That attempt is a failure, not a clean replay; its initial owner selection also needed correction. Temporary diagnostic edits were restored, with no source changes retained.The unchanged security fixture then passed 38/38 tests, no skips, on a clean Blacksmith Testbox: run 37723808269, verified source
aa6157bee0b1, treecbb86a000322270cba469420e73e93b5892b51f3, Node 24.19.0; 2.09 s test-wrapper wall time. This diagnoses the host-specific failure; it is not a full-shard pass. The old release job used Node 24.21.0.A queued full-replay attempt was interrupted by a Gateway restart before executing tests and is not counted. The recovered one-shot run completed all three repetitions against verified source
aa6157bee0b1da514ab0b1e4ac8753d53e56e3ffand treecbb86a000322270cba469420e73e93b5892b51f3. Each repetition used the repository CI shard runner, two workers, and serialized owner groups; its completion record reported three completed invocations and zero failures. An additional check required discovery of every expected file under its correct owner, rejecting omissions, extras, and duplicate owners.Per repetition, tooling had 53 passing files and 1,193 passing / four skipped tests; tooling-isolated had two passing files and 31 passing tests; infra had one passing file and 16 passing / one skipped test. The five skips were the native metadata scan in
openclaw-live-updater.test.ts, three native installer scenarios ininstall-ps1.release.test.ts, and the full cold/warm provisioning case inpr-worktree-provision.test.ts. They are not claimed as executed coverage.Runtime was Node 24.19.0 on Linux; the historical release run used Node 24.21.0. Current canonical isolation is preserved rather than restoring obsolete shared-worker placement. Native Testbox receipt:
exitCode: 0,signal: null,settled: true. The lease stopped automatically and its completed state was verified. The backing Actions job can show cancellation during delegated lease cleanup; the native command receipt establishes this proof, separately from the green PR CI run above.Contributor credit: @RomneyDa for the original release fix and the requested main forward-port.
Work sessions