opencode icon indicating copy to clipboard operation
opencode copied to clipboard

OpenCode hangs/freezes mid-stream on Starlink satellite internet connection

Open gabrielbuzziv opened this issue 3 days ago • 2 comments

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

  1. Connect to Starlink internet
  2. Open a Next.js project with App Router structure
  3. Ask OpenCode to analyze or fix code that requires reading multiple files
  4. OpenCode starts executing tools (Read, Glob, Grep)
  5. Mid-execution, it freezes with spinner showing "Reading file..." or similar
  6. No error message is displayed
  7. 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

  1. Implement connection retry/reconnect logic for streaming responses
  2. Add configurable timeout settings for unstable connections
  3. Better error handling when stream drops - show error instead of hanging
  4. Optional non-streaming fallback mode for problematic networks

gabrielbuzziv avatar Jan 12 '26 13:01 gabrielbuzziv