Skip to content

fix(shared): port checks no longer fail on hosts with IPv6 disabled - #15044

Merged
juliusmarminge merged 5 commits into
pingdotgg:mainfrom
mr-joom:fix/ipv6-disabled-port-checks
Oct 19, 2026
Merged

juliusmarminge merged 5 commits into
pingdotgg:mainfrom
mr-joom:fix/ipv6-disabled-port-checks

Conversation

@mr-joom

@mr-joom mr-joom commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Hosts booted without IPv6 support return EAFNOSUPPORT when a port probe opens an IPv6 socket. The shared network helper treated that as an occupied port, so desktop startup could reject every otherwise free port.

The helper now treats EAFNOSUPPORT like the existing EADDRNOTAVAIL case. IPv4 is still checked, and an occupied IPv4 port remains unavailable. Contributor commits from @mr-joom's #15044 are preserved; main was merged to resolve the conflict.

Verification:

  • Fresh test reduction kept six behavioral cases while removing 48 lines of global mocking. The EAFNOSUPPORT regression fails on main (1 failed, 5 passed) and passes with the fix (6 passed). Focused lint, formatting and shared typecheck passed; the separate implementation pass retained the minimal errno check and shortened the comment. One full-diff review round by Claude Opus 5.5 and Codex GPT-6 Sol found no code issues; both independently reran the six focused cases.
  • Linux process-local seccomp filter returned real kernel EAFNOSUPPORT from socket(AF_INET6, ...). Main reported a free IPv4 port unavailable and discarded the preferred port; the fix reported it available and kept the preferred port. Both versions rejected an occupied IPv4 port. Syscall tracing confirmed the errno.
  • An isolated network namespace with IPv6 addresses disabled exercised the existing EADDRNOTAVAIL path; free and occupied IPv4 behavior stayed correct.

Before/after syscall and port-selection output.

These process-local checks do not change host networking. They reproduce the errno without rebooting into an IPv6-disabled kernel. A machine actually booted with ipv6.disable=1, macOS, Windows, iOS, Android, and Electron desktop were not tested. This is nonvisual port-selection behavior; syscall output and focused tests are the evidence.

Implementation: GPT-6.1 Sol through the Codex harness in T3 Code; tests: GPT-6 Astra; adversarial review: Claude Opus 5.5 and GPT-6 Sol.

On a kernel booted with `ipv6.disable=1`, binding `::` or `::1` fails
with EAFNOSUPPORT. canListenOnHost only treated EADDRNOTAVAIL as
"available", so every port looked taken: the desktop app scanned
3773-65535 and quit with DesktopBackendPortUnavailableError.

Fixes pingdotgg#15038

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Oct 3, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 3, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 86394f1

Macroscope's review found this PR approvable — This is a narrowly scoped shared-network bug fix that handles IPv6-disabled hosts without changing occupied-port detection or APIs. Focused regression coverage is included for both relevant error codes.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 3, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 3, 2026 05:21

Dismissing prior approval to re-evaluate 935a294

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 3, 2026
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8bca2fad-1ae5-438a-a9b6-a916bad5e499
📥 Commits

Reviewing files that changed from the base of the PR and between c5a929e and 935a294.

📒 Files selected for processing (2)
  • packages/shared/src/Net.test.ts
  • packages/shared/src/Net.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

canListenOnHost now treats EAFNOSUPPORT as available, alongside EADDRNOTAVAIL. Tests verify the result for EAFNOSUPPORT and confirm that EACCES still indicates an unavailable host.

Changes: Host availability error handling

Layer / File(s) Summary
Handle unsupported address families
packages/shared/src/Net.ts, packages/shared/src/Net.test.ts
canListenOnHost treats EAFNOSUPPORT like EADDRNOTAVAIL. Tests use a mocked listener to verify that EAFNOSUPPORT returns true and EACCES returns false.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 935a2

This fix lets port checks pass on hosts with IPv6 disabled, so the desktop app no longer exits with a port-unavailable error. Other bind failures are still reported as unavailable. No merge-blocking risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Linked Issues check Passed Issue [#15038] requires port checks to allow desktop startup when IPv6 is disabled. canListenOnHost now treats EAFNOSUPPORT like EADDRNOTAVAIL, and tests cover the IPv6-disabled case plus reject…
Out of Scope Changes check Passed The source change and tests directly address issue [#15038]. No unrelated changes appear in the pull request diff.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Title check Passed The title clearly and concisely describes the fix for port checks on hosts without IPv6 support. It uses a conventional commit format and matches the main change.
Description check Passed The description explains the problem, the implementation, verification results, tested environments, limitations, and agent usage. It provides focused evidence for the behavioral change. The scope sec…
Full details: Linked Issues check

Explanation

Issue [#15038] requires port checks to allow desktop startup when IPv6 is disabled. canListenOnHost now treats EAFNOSUPPORT like EADDRNOTAVAIL, and tests cover the IPv6-disabled case plus rejection of EACCES.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

Full details: Description check

Explanation

The description explains the problem, the implementation, verification results, tested environments, limitations, and agent usage. It provides focused evidence for the behavioral change. The scope section does not explicitly link the underlying issue or maintainer approval, but the provided PR objectives identify issue #15038 and the description is otherwise complete.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@juliusmarminge juliusmarminge self-assigned this Oct 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Taking over this one. I'll merge main into the branch, trim the tests to the minimum, keep the fix, run adversarial reviews, and push here. Thanks @mr-joom for the root cause.

@macroscopeapp
macroscopeapp Bot dismissed their stale review October 19, 2026 02:40

Dismissing prior approval to re-evaluate 86394f1

@juliusmarminge
juliusmarminge merged commit 74904e3 into pingdotgg:main Oct 19, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants