OpenCode hangs/freezes mid-stream on Starlink satellite internet connection
Description
OpenCode consistently hangs during tool execution (Read, Glob, Grep) when using Starlink satellite internet. The same setup works perfectly when switching to 4G mobile connection.
The issue appears to be related to Starlink's network characteristics (satellite handoffs, latency jitter, CGNAT) causing the streaming HTTP connection to drop or stall without proper error handling/recovery.
Environment
- OpenCode version: 1.1.14
- OS: Ubuntu 22.04
- Node version: 22 (also tested with 24)
- Internet: Starlink satellite
- Provider: OpenCode Zen (also tested with OpenRouter - same issue)
- Terminal: Default
Steps to reproduce
- Connect to Starlink internet
- Open a Next.js project with App Router structure
- Ask OpenCode to analyze or fix code that requires reading multiple files
- OpenCode starts executing tools (Read, Glob, Grep)
- Mid-execution, it freezes with spinner showing "Reading file..." or similar
- No error message is displayed
- Logs show streaming started but then stops receiving message.part.updated events
Expected behavior
Tool execution completes and assistant responds, even on high-latency/unstable connections.
Actual behavior
OpenCode hangs indefinitely. The last log entries show: ``` INFO service=llm providerID=opencode modelID=claude-sonnet-4-5 ... stream INFO service=bus type=message.part.updated publishing INFO service=bus type=message.part.updated publishing ... (stream stops, no more entries) ```
Workaround
Switching from Starlink to 4G mobile connection resolves the issue completely.
Additional context
Starlink network characteristics that may cause this:
- Frequent satellite handoffs causing brief connection interruptions
- High latency jitter (20ms to 200ms+)
- Aggressive CGNAT with shorter connection timeouts
- TCP connections may be silently reset during satellite switches
Diagnostics performed:
- ✅ curl to api.opencode.ai works (both IPv4 and IPv6)
- ✅ No proxy configured
- ✅ DNS resolution works
- ✅ inotify limits are sufficient (65k+)
- ✅ Node 22 LTS installed
- ✅ Glob/filesystem operations work outside OpenCode
- ❌ NODE_OPTIONS="--dns-result-order=ipv4first" did not help
Possibly related issues:
- #6959 - LSP bug: edit tool stalls after first diff; assistant hangs
- #5888 - OpenCode Hangs when used as CLI tool
Suggested improvements
- Implement connection retry/reconnect logic for streaming responses
- Add configurable timeout settings for unstable connections
- Better error handling when stream drops - show error instead of hanging
- Optional non-streaming fallback mode for problematic networks