Skip to content

OpenCode Go fails at scale: upstream 429 masked as HTTP 500 (union-alpha, mimo-2.5); bare muse-spark-1.3 routes to wrong provider #7

Open

Description

@KooshaPari

Summary

Model routes on OpenCode Go (https://opencode.ai/zen/go/v1) fail at scale. They are perfect at 1–5 concurrent chats, then abruptly fail once the swarm scales up, and keep failing.

Root cause captured from logs: OpenCode Go proxies union-alpha to OpenRouter's stealth/union-alpha, which runs on a shared upstream pool (limit_source: upstream_provider_shared_pool). At scale the upstream returns 429, but OpenCode Go surfaces it to the client as an opaque HTTP 500 / endpoint failure, discarding the 429, the Retry-After guidance, and the remedy hint. Callers therefore see a "dead endpoint" instead of "rate limited, retry shortly."

Environment

Field Value
Harness jcode v0.84.0 (57d5878)
Provider OpenCode Go / OpenCode Zen (gateway) → OpenRouter (upstream)
Base URL https://opencode.ai/zen/go/v1
Models affected union-alpha, mimo-2.5 / mimo-v2.5
Models OK deepseek-v4.1-flash (200 OK on the same endpoint)
Config ~/.jcode/config.toml: default_provider = "opencode-go", default_model = "mimo-v2.5", swarm_max_concurrent_agents = 32

Evidence — union-alpha at scale

ERROR AGENT_PROVIDER_STREAM_LIFECYCLE elapsed_ms=92171
  error="OpenAI-compatible chat request failed
    endpoint: https://opencode.ai/zen/go/v1/chat/completions
    model: union-alpha
    auth: OPENCODE_GO_API_KEY
    status: 500 ..."

The upstream body (seen in the same record) is actually a 429:

{"error":{"message":"Provider returned error","code":429,
 "metadata":{"raw":"stealth/union-alpha is temporarily rate-limited upstream. Please retry shortly.",
 "provider_name":"Stealth","is_byok":false,
 "limit_source":"upstream_provider_shared_pool",
 "remedy_hint":"Retry shortly, add your own provider key, or route to another provider"}},
 "user_id":"user_2vIPgFZC2n64ufSHAf55kZ0QV20"}

So: upstream 429 → gateway 500 → client endpoint error. The actionable signal is destroyed in transit.

Evidence — mimo-2.5

Same class of failure on the default model:

Failed to send OpenAI-compatible chat request
endpoint: https://opencode.ai/zen/go/v1/chat/completions
model: mimo-v2.5
auth: OPENCODE_GO_API_KEY

Confirmed independently by the user ("occurs on mimo 2.5 model too"), so this is not model-specific — it is a gateway concurrency/backpressure defect.

Evidence — muse-spark-1.3

Two separate problems:

  1. Routing ambiguity. A bare model: muse-spark-1.3 resolved to OpenRouter (provider=OpenRouter), not the configured default_provider = opencode-go. The catalog exposes both meta/muse-spark-1.3 via OpenRouter and muse-spark-1.3 via OpenCode Zen; the bare name picked the wrong one.
  2. Opaque 403. Once routed to OpenRouter:
ERROR elapsed_ms=41044
  error="OpenAI-compatible chat request failed
    endpoint: https://openrouter.ai/api/v1/chat/completions
    model: muse-spark-1.3
    auth: OPENROUTER_API_KEY
    status: 403 ..."

Also observed on this request: request_json_chars=338329, system_json_chars=262155, tools_json_chars=75093, tool_count=41, and 40.9s just to open the stream. Needs investigation whether the 403 is model-access or the oversized payload.

Reproduction

  1. Set OpenCode Go as default with union-alpha (or mimo-2.5).
  2. Run 1–5 concurrent chats/workers. Succeeds reliably.
  3. Scale the swarm to 10–32 workers and dispatch short-request bursts.
  4. Requests begin failing at the endpoint layer within a short window and continue failing.

Abrupt transition, no visible backoff, no 429 surfaced to the caller.

Impact

  • Large fan-out test-generation / codegen swarms cannot use this provider.
  • A full agent wave was lost to this and had to be re-run on a different route.
  • Operators/agents cannot tell whether to retry, throttle, or switch providers, because the retryable 429 is hidden behind a 500.
  • Bare model names can silently route to the wrong provider, bypassing the configured default.

Requested fixes

  1. Propagate the upstream status. Pass through 429 (and Retry-After) instead of collapsing it to 500. Keep the remedy_hint and limit_source for diagnostics.
  2. Distinguish saturation from failure with a machine-readable error (e.g. provider_overloaded).
  3. Client backpressure: bounded in-flight semaphore + exponential backoff with jitter, so bursts don't exceed the shared-pool ceiling.
  4. Deterministic model routing: bare muse-spark-1.3 should resolve to the configured default_provider, or require an explicit provider/model when a name is ambiguous.
  5. Log the truncated upstream body at the gateway, since the real cause is only visible in the raw response today.

Notes

  • Low-concurrency correctness is confirmed — this is scale-only.
  • Found during an AgilePlus test-coverage swarm (Wave 6). After switching to a working route, the same wave completed and pushed (a57c17e7).
  • Workaround in use: deepseek-v4.1-flash on the same OpenCode Go endpoint returned 200 OK while union-alpha was failing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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