Skip to content

Expose stream timeout/retry state to users — silent infinite retry leaves UI stuck on "thinking" for 20+ min (opencode-go/hy3, Desktop v1.18.23) #45514

Description

@wujialeHK

Summary

When an LLM stream fails with Headers Timeout Error (upstream returns no headers within the ~5 min default limit), the desktop UI keeps showing "thinking…" while the client silently retries with no backoff and no max attempts. Users cannot tell whether the model is reasoning, the network is slow, or the service is down — the error is only discoverable via logs.

Environment

  • OpenCode Desktop v1.18.23 (Windows)
  • Provider: opencode-go · Model: opencode-go/hy3 (orchestrator)
  • "部署在中国的模型" toggle: enabled
  • Account: subscribed, quota healthy (5h usage ~6%)

Repro

  1. Send a message with hy3 as orchestrator → UI shows "thinking…"
  2. Every ~5m07s the log records AI_APICallError: Cannot connect to API: Headers Timeout Error (HeadersTimeoutError), then auto-retries immediately — the loop repeats indefinitely
  3. After 20+ minutes of silent waiting, the user manually cancels; only then does checking ~/.local/share/opencode/log/opencode.log reveal the errors
  4. Switching to opencode-go/deepseek-v4-flash in the same session works instantly

Timeline (2026-08-27, one session)

Time (UTC+8) Event
13:58:41 Request #1 (hy3)
14:03:48 Headers Timeout Error (5m07s wait) → auto retry
14:08:57 Timeout #2 (5m06s) → auto retry
14:14:09 Timeout #3 (5m07s) → auto retry
14:19:26 Timeout #4 (5m08s) → auto retry
14:21:57 User manually cancels
14:22:53 Switch to opencode-go/deepseek-v4-flash → instant, normal responses

Log excerpt (sanitized)

timestamp=2026-08-27T05:58:41.318Z level=INFO message="llm runtime selected" llm.runtime=ai-sdk llm.provider=opencode-go llm.model=hy3
timestamp=2026-08-27T06:03:48.830Z level=ERROR message="stream error" providerID=opencode-go modelID=hy3 agent=orchestrator mode=primary error.error="AI_APICallError: Cannot connect to API: Headers Timeout Error (cause: HeadersTimeoutError: Headers Timeout Error)"
timestamp=2026-08-27T06:03:51.240Z level=INFO message=stream providerID=opencode-go modelID=hy3 ...   # auto retry
timestamp=2026-08-27T06:08:57.666Z level=ERROR message="stream error" ... error.error="AI_APICallError: Cannot connect to API: Headers Timeout Error ..."
timestamp=2026-08-27T06:09:02.270Z level=INFO message=stream ...                            # auto retry
# ... repeats at 06:14:09, 06:19:26 ...
timestamp=2026-08-27T06:21:57.481Z level=INFO message=cancel ...                         # user cancels

Expected behavior

  1. Surface the failure to the user. On the first stream failure, show a visible status/error in the UI (e.g. banner or notification: "Model service timed out, retrying (1/N)…") instead of continuing to show "thinking…"
  2. Bound the retries. Add max attempts + exponential backoff; after exhausting them, present a clear error with actionable choices (retry / switch model / stop)
  3. Notify on recoverable timeouts. Route server-side stream timeouts into the existing error-notification channel (Settings > General > System Notifications > Errors) so background sessions alert the user in time

Related issues

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions