fix(infra): pin ensurePortAvailable to 127.0.0.1 in startSshPortForward#94602
fix(infra): pin ensurePortAvailable to 127.0.0.1 in startSshPortForward#94602xzh-icenter wants to merge 1 commit into
Conversation
Every other probe in ssh-tunnel.ts is pinned to IPv4 loopback (pickEphemeralPort, canConnectLocal, the -L forward itself), but ensurePortAvailable was called host-less. On a dual-stack host the host-less probe binds the IPv6 wildcard :: and misses an IPv4-only occupant, reporting a busy port as free. Pass "127.0.0.1" to match the interface this caller actually owns, consistent with the fix in openclaw#94394. Fixes openclaw#94596
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded by #94607: the reported SSH tunnel bug is real, but this branch only applies the host-scoped probe while the open sibling also handles the Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Land one canonical SSH tunnel fix that scopes the preflight to So I’m closing this here and keeping the remaining discussion on #94607. Review detailsBest possible solution: Land one canonical SSH tunnel fix that scopes the preflight to Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows the patched call would surface Is this the best way to solve the issue? No. Passing Security review: Security review cleared: The diff only narrows a local loopback port-probe argument and does not touch dependencies, workflows, secrets, permissions, downloaded artifacts, or other code-execution surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 712e69dd7479. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
/clownfish automerge |
|
Clownfish is on the reef for this PR. 🐠 I tagged A maintainer can call |
|
/clownfish automerge |
|
Clownfish is on the reef for this PR. 🐠 I tagged A maintainer can call |
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
|
Hi @vincentkoc — I see you've triggered clownfish automerge twice on this PR, but ClawSweeper is still in needs-human state. Is there anything I should do on my end, or is this waiting on a maintainer decision? |
Fixes #94596
Summary
startSshPortForwardinssh-tunnel.tscallsensurePortAvailable(localPort)without a host argument. On dual-stack hosts the host-less probe binds the IPv6 wildcard::and misses an IPv4-only occupant, reporting a busy port as free.ensurePortAvailable(port, host?)API but missed this call site."127.0.0.1"toensurePortAvailableinstartSshPortForward, matching every other probe in the module.ensurePortAvailableitself,pickEphemeralPort,canConnectLocal, or the SSH forward args. This is a one-line caller-side fix.src/infra/ssh-tunnel.tsline 122.Verification
Real behavior proof
Behavior addressed: SSH tunnel port preflight on dual-stack hosts now correctly detects IPv4-only occupants, preventing false-free reports.
Environment tested: Windows 11 (x64, dual-stack), Node.js v24.16.0.
Steps run after the patch:
Evidence after fix (console output):
Observed result: The host-less probe (old code) reports the port as FREE despite an IPv4-only listener — the exact bug. The scoped probe with
127.0.0.1(new code) correctly detectsEADDRINUSE. The IPv6 probe confirms the root cause: IPv6 wildcard bind does not conflict with IPv4-only listeners on dual-stack hosts.Not tested: Live SSH tunnel (requires a real SSH server). The fix is a one-line argument addition following the exact pattern from #94394.