Skip to content

[opencode-go] deepseek-v4.1-flash: ~30% of API requests stall ~110s then fail with "unexpected EOF" before first token (tiny prompts included) #57270

Closed as not planned

Description

@MuQingWen

Description

Description

I use OpenCode Go directly over HTTPS (no OpenCode client/CLI in the loop; a local gateway + raw curl). Since 2026-10-19 06:00 UTC, roughly 30% of requests to deepseek-v4.1-flash never receive response headers: they hang for ~105–115 s, then the connection is closed (unexpected EOF; curl reports HTTP 000). Retrying the identical request immediately usually succeeds in 2–4 s with a warm prompt cache. This also happens with a 46-token prompt, so it is not context/prefill. Once the first token arrives, streaming speed is normal (~200–230 tok/s).

Impact: agent sessions (40–60 sequential calls) take ~1 h instead of ~10–15 min; ~65% of total request time is spent in attempts that produce no output.

Gateway-log evidence (UTC; control = same gateway, DeepSeek official API):

window upstream attempts failed failure rate failed attempt p50 TTFT p50 / p90
2026-10-19 06:00–08:59 243 80 33% 108.6 s 8.4 s / 120.5 s
2026-10-20 01:00–02:59 197 60 30% 110.1 s 4.5 s / 140.7 s
DeepSeek official (control) 307 2 (client cancel) <1% — 0.95 s / 1.47 s

Failure signature: request body written in <1 ms, then no bytes for ~109 s, then EOF, e.g.:

{"status":502,"ms":109288,
 "net":{"own":0.8,"asks":1,"reused":true,"send":0.2},
 "error":"Post \"https://opencode.ai/zen/go/v1/chat/completions\": unexpected EOF"}

Tracer IDs (request start time in UTC → the successful retry's response id right after the stall; no keys/user content included):

  • 2026-10-19T06:32:00Z stalled 115.9 s → retry OK, response chatcmpl-4fc06046f0eb430099757544c1050fed
  • 2026-10-19T06:39:57Z stalled 102.0 s → retry OK, response gw-a70a2abc01d3-4c4a05
  • 2026-10-19T06:46:03Z stalled 104.5 s → retry OK, response gw-a697b26c5509-4caafa

Also observed: mid-stream EOF without finish_reason / [DONE] (39× connection lost mid-reply (unexpected EOF) across sessions) — likely related to #57033.

Not client-specific: reproduced with raw curl/python (no OpenCode client), with x-opencode-session set and an identifying User-Agent; SG / HK / US egress all affected; both /zen/go/v1/chat/completions (gateway default) and the documented /inference/go/openai/v1/chat/completions were tested (in a quiet window both were 20/20 fast — the failure is bursty/time-dependent).

Related: #36889 (intermittent outages / Cloudflare 524 family), #57055 (first-token latency scales with context), #57033 (streams end without finish_reason). Difference from #57055: tiny prompts are affected too, and failed attempts end in EOF after ~110 s rather than a slow first token.

Plugins

None. Not using the OpenCode client; direct HTTP calls to the OpenCode Go API (Go plan, model deepseek-v4.1-flash).

OpenCode version

N/A — no OpenCode client/CLI involved. Client is a local gateway (Magpie 0.1.1290) plus raw curl on macOS.

Steps to reproduce

  1. Use a Go-plan API key and run the loop below (tiny prompt, fresh x-opencode-session per request, max_tokens: 8) ~20 times during a busy period.
  2. Healthy responses: 2–4 s. Affected responses: no bytes for ~105–115 s, then HTTP 000 / unexpected EOF.
  3. Re-run any stalled request immediately: it normally succeeds in 2–4 s.
for i in $(seq 1 20); do
  curl -sS -m 130 -o /dev/null \
    -w "%{http_code} ttfb=%{time_starttransfer} total=%{time_total}\n" \
    -X POST https://opencode.ai/zen/go/v1/chat/completions \
    -H "Authorization: Bearer $OPENCODE_GO_KEY" \
    -H "Content-Type: application/json" \
    -H "User-Agent: my-coding-agent/1.0" \
    -H "x-opencode-session: my-agent-$(uuidgen)" \
    --data '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Say ok"}],"max_tokens":8,"temperature":0}'
done

Note: as of 2026-10-20 03:40 UTC, 20/20 requests were fast on both endpoints; the issue is intermittent (worst observed hours: 63% and 70% failure).

Screenshot

Attached: opencode-go-evidence.png (summary + failure rate by UTC hour) and opencode-go-evidence.md (sanitized logs, more tracer IDs, cross-client tests).

Operating System

macOS 27.0.1 (26A434), arm64

Terminal

N/A — direct HTTP client (no terminal app; reproduction commands run via shell)


Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot

Image

opencode-go-evidence.md

Operating System

No response

Terminal

No response

Activity

  1. opencode-agent commented on Oct 20, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report: the failure rates per time window, the tracer IDs and the comparison against DeepSeek's own API are very useful.

    This is a problem with the hosted OpenCode Go service, not the OpenCode app, so it can only be looked into on the service side. Billing and account support, including problems with the Go service, isn't handled in GitHub issues. Please email help@anoma.ly with the details: the time windows, the tracer and response IDs, and the attached evidence file. If you've already emailed, the team will get to it, especially now that we've seen it here. Please keep API keys, email addresses and account information out of this public issue and put them only in the email.

    Related reports, ordered by how closely they match:

    The bot will close this issue in 1 day.

  2. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Hi @MuQingWen, closing this now. Problems with the hosted OpenCode Go service are handled by email, not in GitHub issues. If the stalls are still happening, please email help@anoma.ly with your time windows, tracer IDs and evidence file, and keep keys and account details out of this public thread. Related public issues, if you want to follow them: #36889 and #57033. Thanks again for such a thorough report.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions