anomalyco / anomalyco/opencode

Managed gateway (provider "opencode") kills turns mid-stream: intermittent 503s + silent hangs with no client timeout

Open
#44,044 2 comments 0 reactions 1 assignee View on GitHub

@MrMushrooooom is already working on this.

Since Aug 22, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Summary

Over ~2 months of local logs, agent turns on the managed opencode provider (big-pickle) die mid-stream in two distinct modes. Evidence below is from ~/.local/share/opencode/log/opencode.log plus direct SQLite inspection of opencode.db (message/part/token tables).

Mode B - explicit 503

AI_APICallError: Service Unavailable at ERROR level, providerID=opencode modelID=big-pickle. Client auto-retries (~2s later); turn dies when consecutive attempts fail. Partial streamed text persists via deltas, but step-finish/usage parts are never written - user sees truncated output with no error surfaced in the UI.

Occurrences (UTC):

  • 2026-08-11T08:24, 08:38 - ses_010269ddeffe5pMcJNWHi8HxVg
  • 2026-08-21T21:52:20 - ses_fde976355ffeJ3zlIR4zXtArN2
  • 2026-08-21T23:14:42, 23:39:08, 23:46:08 - ses_fd9a6264dffeYcBr4Swo110vQk
  • 2026-08-21T23:25:09, 23:26:16 - ses_fd95cb1e1ffeD0SUa5R4z6iZ2O
  • 2026-08-21T23:34:38 - ses_fd9577e34ffey9VkEl1l7aYrAP (subagent)
Mode A - silent hang (worse)

Stream opens (message=stream logged), zero parts persisted, no error line. Hangs indefinitely until user abort/retry, then logged as error=Aborted. No client-side stream timeout exists.

Example: message msg_02107484b00163Rm57QVpjKXu2, stream started 2026-08-20T21:15:20Z, marked Aborted 22:46:04Z - hung for 90 minutes.

Supporting data
  • 36 dead turns (assistant messages with tokens.output=0, usage never persisted) cluster in time bursts across different sessions in the same window: Aug 10/11, Aug 18, Aug 20/21. Burst pattern across sessions = provider capacity episodes, not per-client state.
  • A failed turn's immediate retry succeeded 2 minutes later at nearly identical context size (~107k -> ~108k ctx tokens) = transient upstream failure.
  • Zero occurrences of ECONNRESET / fetch failed / socket hang up / ETIMEDOUT / EPIPE in the full log since June 24 = not local network.
  • Deaths occur at context sizes ~100k-140k, but successful turns also occur at 139k+ = not a context-length threshold.
  • Primary agent and subagent turns fail identically with the same error signature = not subagent orchestration.
Requests
  1. Investigate gateway capacity during the burst windows above.
  2. Add a client-side stream watchdog/timeout for Mode A silent hangs.
  3. Surface swallowed stream errors in the desktop UI instead of silent truncation.

Happy to share forensics scripts and the dead-turn CSV if useful.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.