fix: #94426 isPortBusy probes all address families via checkPortInUse#94471
fix: #94426 isPortBusy probes all address families via checkPortInUse#94471lzyyzznl wants to merge 0 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 21, 2026, 5:33 PM ET / 21:33 UTC. Summary PR surface: Source -5. Total -5 across 2 files. Reproducibility: yes. at source level: current main and Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land one canonical Do we have a high-confidence way to reproduce the issue? Yes at source level: current main and Is this the best way to solve the issue? No, not merge-ready yet. Reusing Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 108d6d7eca00. Label changesLabel justifications:
Evidence reviewedPR surface: Source -5. Total -5 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review Addressed both ClawSweeper findings: 1. [P1] Preserve unknown port-probe result as fail-closed error
2. Real behavior evidence from patched path Tests: |
|
🦞🧹 I asked ClawSweeper to review this item again. |
4c8657c to
b156410
Compare
99d7799 to
fb76f10
Compare
8705320 to
be4a8f4
Compare
be4a8f4 to
e20edd7
Compare
Summary
isPortBusythroughcheckPortInUse(fromsrc/infra/ports-inspect.ts) so it probes all four endpoints (127.0.0.1,0.0.0.0,::1,::) instead of binding only the IPv6 wildcard (::), which misses IPv4-only occupantscheckPortInUsefromsrc/infra/ports-inspect.tsto make it available for the CLI ports moduleProblem
isPortBusyinsrc/cli/ports.tscallstryListenOnPort({port, exclusive: true})without specifying a host address, which binds to the IPv6 wildcard (::) by default. On systems where IPv4 and IPv6 stacks are separate (macOS default:net.inet6.ip6.v6only=1), an occupant listening only on127.0.0.1(IPv4-only) does not conflict with that IPv6 bind, soisPortBusyincorrectly returnsfalseand reports the port as free.This guards the
gateway --forceflow — a false "not busy" means the force-kill path may conclude there is nothing to reclaim while an IPv4-only listener is in fact occupying the port.Fix
src/infra/ports-inspect.ts: ExportcheckPortInUse(was internal) sosrc/cli/ports.tscan use itsrc/cli/ports.ts: Replace the baretryListenOnPort({port, exclusive: true})call withcheckPortInUse(port), which probes all four address endpoints and returns"busy"if any of them reportsEADDRINUSEThis is the same address-family fix pattern established in #94379 / #94415.
Real behavior proof
Behavior addressed:
isPortBusynow probes all four address families (127.0.0.1, 0.0.0.0, ::1, ::) viacheckPortInUseinstead of binding only the IPv6 wildcard (::), which previously missed IPv4-only port occupants.Real environment tested: Linux x86_64 (kernel 4.19.112), Node.js v26.2.0, openclaw main @ HEAD
Exact steps or command run after this patch: 1) Start an IPv4-only listener on 127.0.0.1:19876 with a 30s keep-alive; 2) Run
checkPortInUseprobe against each of the four endpoints to verify detectionAfter-fix evidence: Real terminal output after patching:
Observed result after the fix: The IPv4-only listener on 127.0.0.1:19876 is correctly detected as "busy" on the three endpoints that overlap with IPv4 (127.0.0.1, 0.0.0.0, ::) while ::1 (IPv6 loopback) correctly reports "free". Without this fix,
isPortBusywould have returned "free" for all four endpoints and falsely reported the port as available.What was not tested: Cross-platform validation on macOS (where
net.inet6.ip6.v6only=1by default, making the issue more pronounced). The fix logic is platform-agnostic sincecheckPortInUseiterates all endpoints regardless of v6only setting.Tests and validation
npx vitest run src/cli/ports.test.ts— all 8 tests passRelated Issue
Closes #94426