Skip to content

fix(mac): prevent network discovery crashes on addressless interfaces - #129265

Merged
steipete merged 1 commit into
mainfrom
codex/qa-native-network-null-interface-20260825
Aug 25, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-native-network-null-interface-20260825

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where the macOS application could crash while discovering network interfaces when Darwin returned a valid interface record that temporarily had no assigned address.

Why This Change Was Made

Darwin documents that getifaddrs may return a null ifa_addr. The existing iOS sibling already checks that contract, while the shared macOS networking owner unconditionally dereferenced it. Guard the pointer before reading the address family and reuse the verified pointer for the remaining address operations.

Production delta: 4 additions / 4 deletions (net 0). No public API, configuration, protocol, authentication, persistence, or dependency changes.

User Impact

Network discovery, presence reporting, Mac connection flows, and Tailscale integration no longer crash when a VPN, virtual adapter, or transitioning interface temporarily has no assigned address.

Evidence

  • Direct local Darwin getifaddrs documentation explicitly permits ifa_addr == NULL.
  • Deterministic compiled actual-owner fixture supplied an up, non-loopback, addressless interface followed by a valid IPv4 interface: before, process crashed with exit 133; after, it skipped the null entry and returned the valid 192.0.2.23 address.
  • swiftc -typecheck passed for both the shared IPv4 owner and its public caller.
  • Repository-configured SwiftFormat lint passed with zero formatting changes; git diff --check passed.
  • Full SwiftPM suite intentionally not run because this isolated worktree lacks its package build cache and would require remote dependency resolution; the actual-owner compiled crash regression directly verifies the changed OS boundary.
  • Fresh independent structured review was clean.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 7:20 AM ET / 11:20 UTC.

ClawSweeper review

What this changes

The PR skips Darwin network-interface records without an address before extracting IPv4 data in OpenClawKit’s shared network helper.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding: this is a focused shared-owner repair for a current-main macOS crash path. It remains open because it is maintainer-owned and the exact-head macOS checks are still running.

Priority: P1
Reviewed head: b1783ba90c1acdb081b98de2df6bde01c79b47ba
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with a stated compiled regression check and no blocking correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix compiled Darwin-owner fixture.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix compiled Darwin-owner fixture.
Evidence reviewed 4 items Current-main failure point: Current main dereferences the optional interface address before checking it, so an addressless record reaches an unsafe access.
Owner-boundary repair: The patch binds the address only after the null check and reuses that verified pointer for the family and length reads.
Caller and sibling coverage: The shared enumerator feeds primary-address selection and Tailscale detection; the iOS sibling already skips a missing address pointer before reading its family.
Findings None None.
Security None None.

How this fits together

OpenClawKit reads Darwin interface records and produces IPv4 addresses for macOS presence reporting and Tailscale discovery. Those callers select a primary address or a tailnet address from the shared enumerator’s output.

flowchart LR
  A[Darwin interface records] --> B[Shared IPv4 enumerator]
  B --> C{Address and IPv4?}
  C -->|yes| D[IPv4 address entries]
  C -->|no| E[Skip interface]
  D --> F[Primary address selection]
  D --> G[Tailscale detection]
  F --> H[Mac presence and discovery]
  G --> H
Loading

Decision needed

Question Recommendation
After exact-head macOS checks finish, should this maintainer-owned crash repair be merged as the shared network-interface fix? Merge after macOS validation: Merge when the running macOS checks confirm the PR head builds and validates cleanly.

Why: The protected maintainer label requires explicit maintainer handling; the remaining decision is ordinary exact-head validation rather than product direction.

Before merge

  • Resolve merge risk (P1) - This Linux review checkout lacks the Darwin SDK, so the PR body’s compiled native fixture could not be independently rerun here; wait for the exact-head macOS checks.
Agent review details

Security

None.

PR surface

Other 0. Total 0 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 4 0
Total 1 4 4 0

Review metrics

Metric Value Why it matters
Production versus test delta production +4/-4 (net 0); tests 0 The crash guard is absorbed into the existing owner without adding public API, configuration, or persistence surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the null check in the shared enumerator and merge once the exact PR head has passed macOS validation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the null check in the shared enumerator and merge once the exact PR head has passed macOS validation.

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

Yes—current main dereferences the optional Darwin address pointer before filtering the record, and the PR body describes a compiled addressless-record fixture that crashes before the fix.

Is this the best way to solve the issue?

Yes—the shared enumerator owns the unsafe dereference, and validating the pointer once before every address read is the narrowest maintainable repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8166cc01b94d.

Labels

Label changes:

  • add P1: Current main can crash macOS network discovery when Darwin supplies an addressless interface record.
  • 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: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix compiled Darwin-owner fixture.

Label justifications:

  • P1: Current main can crash macOS network discovery when Darwin supplies an addressless interface record.
  • 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: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix compiled Darwin-owner fixture.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame and nearby shared networking history attribute the affected helper and its macOS callers to this contributor. (role: recent shared-networking contributor; confidence: high; commits: daefcc117f29, f37b1c11e068, 218189318d91; files: apps/shared/OpenClawKit/Sources/OpenClawKit/NetworkInterfaceIPv4.swift, apps/shared/OpenClawKit/Sources/OpenClawKit/NetworkInterfaces.swift, apps/macos/Sources/OpenClawDiscovery/TailscaleNetwork.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Allow the running exact-head macOS checks to complete before merge.

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 9444aa5 into main Aug 25, 2026
75 checks passed
@steipete
steipete deleted the codex/qa-native-network-null-interface-20260825 branch August 25, 2026 13:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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