#10030: Guard network interface enumeration
gateway
stale
size: XS
Cluster:
Gateway Error Handling Improvements
Handle os.networkInterfaces() errors in restricted environments to prevent CLI crashes. Also make systemd user service check
tolerant when the user bus is unavailable.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR hardens system/environment probing paths used by the CLI/daemon.
- In `src/infra/tailnet.ts`, it wraps `os.networkInterfaces()` so failures in restricted environments (e.g., sandboxed containers, limited /proc access) don’t crash the process.
- In `src/infra/system-presence.ts` and `src/daemon/systemd.ts`, it makes “systemd user service present/running” checks tolerant of a missing/unreachable user D-Bus, avoiding false negatives and hard failures.
Overall, the changes fit into the existing “system presence” detection and tailnet networking utilities by converting previously-throwing environment queries into best-effort checks that degrade gracefully.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are narrowly scoped to error-handling around environment detection (`os.networkInterfaces()` and systemd user-bus checks) and are unlikely to affect core functionality beyond preventing crashes in restricted environments.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#7060: fix: handle uv_interface_addresses failure on Android/Termux
by kjoh94 · 2026-02-02
83.1%
#7675: fix: handle network interface retrieval errors in resolvePrimaryIPv4
by cre47e · 2026-02-03
81.7%
#7563: fix: expand transient network error detection
by kaigritun · 2026-02-03
78.5%
#7892: Claude/setup agent firewall ww xsv
by starwreckntx · 2026-02-03
77.3%
#6113: support ipv6
by DingProg · 2026-02-01
76.3%
#7316: fix: /chat dashboard performance
by felipcsousa · 2026-02-02
76.2%
#6110: refactor: simplify boolean logic using nullish coalescing
by T1mn · 2026-02-01
75.1%
#8876: Confirmaciones para equipo de IT
by m4xjunior · 2026-02-04
74.9%
#4653: fix(gateway): improve crash resilience for mDNS and network errors
by AyedAlmudarra · 2026-01-30
74.8%
#6512: Claude/setup open claw agent f v sqk
by franelcisco · 2026-02-01
74.4%