Skip to content

fix(portals): reach IPv6 loopback with IPv4-only localhost records - #140580

Merged
steipete merged 1 commit into
mainfrom
codex/test-loopback-dns-fixtures
Sep 7, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-loopback-dns-fixtures

Conversation

@steipete

@steipete steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Related: #139428

What Problem This Solves

Fixes an issue where users opening a portal backed by an IPv6-only local server would fail to connect when the host's localhost records listed only IPv4. This affects both Gateway-hosted targets and worker portal streams, despite their documented support for either loopback family.

Why This Change Was Made

Gateway and worker connections now share explicit IPv4 and IPv6 loopback lookup options while retaining Node's automatic family selection. The lookup supplies only 127.0.0.1 and ::1; connection ordering relative to portal attachment, cancellation, and socket cleanup stays with the existing owners. The portal documentation now makes the host-DNS independence explicit.

User Impact

Portals can reach IPv4-only or IPv6-only local applications even when system localhost records omit the application's address family. No configuration change is required.

Evidence

Controlled IPv4-only localhost resolution made both existing integration suites fail before the production fix. With the fix, all 83 cases across five focused files passed, including real Gateway and worker socket flows. The final helper test adjustment passed both explicit-family cases. Fresh independent P2 review is scoped-clean with no actionable findings.

The final full changed gate, formatting, diff checks, and deslop passed. An earlier gate caught a Promise executor lint issue; the corrected helper passed both cases and the complete gate. This correctness repair adds 58 test/support lines and 24 production lines, recorded as campaign offsets. No local build, aggregate coverage, or runtime improvement claim is made.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 7, 2026 01:31
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 9:38 PM ET / September 7, 2026, 01:38 UTC.

ClawSweeper review

What this changes

The PR makes Gateway and worker portals try both loopback address families regardless of localhost DNS records, with regression coverage and updated documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair: current main still depends on system localhost records in both affected paths. No actionable introduced defect was found, and the maintainer-protected PR is not a cleanup candidate.

Priority: P2
Reviewed head: 8408a1f012de5e8cb984a78a17d3b4c667faa25b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports Gateway HTTP and worker TCP/WebSocket recovery under injected IPv4-only DNS; inspected tests exercise those production paths, but no execution was performed in this review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports Gateway HTTP and worker TCP/WebSocket recovery under injected IPv4-only DNS; inspected tests exercise those production paths, but no execution was performed in this review.
Evidence reviewed 8 items Current main still has the reported dependency: The Gateway proxy still connects to localhost with automatic family selection but no explicit lookup; this cannot supply an address family omitted by system resolution.
Worker path has the same remaining gap: Current main also relies on localhost resolution when connecting worker portal targets. The proposed change preserves attachment ordering, abort handling, and cleanup.
Bounded production repair: The introduced helper supplies only 127.0.0.1 and ::1, retains automatic family selection, and handles explicit-family lookup callbacks asynchronously. It introduces no configuration, persistence, dependency, or authorization changes.
Findings None None.
Security None None.

How this fits together

Portals proxy browser HTTP and WebSocket traffic to development servers on the Gateway host or a connected worker. The changed connection options determine how those servers are reached over local TCP.

flowchart TD
  A[Browser request] --> B[Portal authorization]
  B --> C{Application location}
  C --> D[Gateway connection]
  C --> E[Worker stream]
  D --> F[Explicit loopback addresses]
  E --> F
  F --> G[Local development server]
  G --> H[Proxied response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +24, Tests +58, Docs 0. Total +82 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 28 4 +24
Tests 4 58 0 +58
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 87 5 +82

Review metrics

None.

Technical review

Best possible solution:

Keep loopback address selection shared across Gateway and worker portals while preserving existing authorization, cancellation, and connection cleanup.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: an IPv6-only application with IPv4-only localhost resolution leaves both current-main callers without the required address. The PR adds this controlled scenario; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Supplying the two loopback literals at the shared dialing boundary repairs the documented contract without a new setting or changes to lifecycle ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b39b6276cac2.

Labels

Label changes:

  • add P2: Repairs portal connectivity for hosts whose localhost records omit the application's loopback address family.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports Gateway HTTP and worker TCP/WebSocket recovery under injected IPv4-only DNS; inspected tests exercise those production paths, but no execution was performed in this review.

Label justifications:

  • P2: Repairs portal connectivity for hosts whose localhost records omit the application's loopback address family.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports Gateway HTTP and worker TCP/WebSocket recovery under injected IPv4-only DNS; inspected tests exercise those production paths, but no execution was performed in this review.

Evidence

What I checked:

  • Current main still has the reported dependency: The Gateway proxy still connects to localhost with automatic family selection but no explicit lookup; this cannot supply an address family omitted by system resolution. (src/gateway/portals/portal-http-proxy.ts:225, b39b6276cac2)
  • Worker path has the same remaining gap: Current main also relies on localhost resolution when connecting worker portal targets. The proposed change preserves attachment ordering, abort handling, and cleanup. (src/node-host/node-stream-transport.ts:272, b39b6276cac2)
  • Bounded production repair: The introduced helper supplies only 127.0.0.1 and ::1, retains automatic family selection, and handles explicit-family lookup callbacks asynchronously. It introduces no configuration, persistence, dependency, or authorization changes. (src/infra/loopback-connect.ts:3, 8408a1f012de)
  • Regression coverage exercises production connections: The Gateway case injects IPv4-only localhost resolution and expects an HTTP 200 response from an IPv6 listener. Worker coverage exercises the production command with real TCP/WebSocket peers, checks echo delivery, then explicitly aborts and checks peer cleanup. The captured PR body reports before-fix failures and 83 passing focused cases; this review did not execute tests. (src/node-host/portal-stream-command.test.ts:82, 8408a1f012de)
  • Sibling transport behavior remains intact: Desktop streaming passes an already-established stream, so it does not enter the changed port-based connection branch. (src/node-host/desktop-stream-command.ts:151, 8408a1f012de)
  • Area history and routing: Available main history records Peter Steinberger across worker portal support, portal reachability, streaming responses, and recent node transport maintenance. Exact source-line provenance could not be completed because older blobs were unavailable; no introduction attribution is asserted. (src/node-host/node-stream-transport.ts, b39b6276cac2)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit c565101 into main Sep 7, 2026
246 checks passed
@steipete
steipete deleted the codex/test-loopback-dns-fixtures branch September 7, 2026 01:55
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 7, 2026
…137098

* commit '8a540c252002878f3c3e9d8dfb837b83c8602a78': (2210 commits)
  perf(plugins): keep bundled catalog lookups lightweight (#140597)
  refactor: streamline skills JSON serialization (#140581)
  fix(feishu): expand quoted merged-forward messages (#136231)
  fix(talk): keep opaque realtime routes out of public config (#129144)
  fix(ci): avoid Linux packaging on pull requests (#140589)
  fix(usage): release completed request payloads (#140588)
  fix(tooling): omit Trae machine squash credit (#140562)
  fix(ui): stop catalog paging in hidden tabs (#140583)
  fix(portals): reach IPv6 loopback with IPv4-only localhost records (#140580)
  fix(transcripts): preserve fixed and legacy capture history (#140563)
  fix(ui): prevent Talk E2E audio capture stalls (#138803)
  fix(media): release completed document source buffers (#140561)
  fix(anthropic): preserve resumed CLI caches across Git changes (#140566)
  chore(ui): refresh control ui locales (#140586)
  fix(ui): keep usage exports bound to their session instance (#140573)
  refactor(exa): test response readers through tool execution (#140572)
  fix(macos): omit incompatible worker binaries from app bundles (#140557)
  fix: avoid retaining discarded tool output (#140570)
  refactor(gateway): share placement move matching (#140569)
  fix(gateway): preserve child turns during systemd drain (#140568)
  ...

# Conflicts:
#	.agents/skills/release-openclaw-maintainer/SKILL.md
#	docs/reference/RELEASING.md
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant