You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the upstream LLM provider (in my case GitHub Copilot / api.githubcopilot.com) returns transient errors, the session processor enters an infinite retry loop with exponential backoff that grows unbounded. There is no maximum retry count, no circuit breaker, and no configurable limit. Sessions become effectively dead for hours.
The attempt counter increments without limit, and in retry.ts, the delay function when response headers ARE present has no cap:
// WITH headers → no max delay cap!returnRETRY_INITIAL_DELAY*Math.pow(RETRY_BACKOFF_FACTOR,attempt-1)// 2000 * 2^(attempt-1) → attempt 10 = 1,024,000ms (17 min), attempt 15 = 32,768,000ms (9 hrs)
Only the NO-headers path has a 30-second cap (RETRY_MAX_DELAY_NO_HEADERS). When the upstream sends error responses WITH headers (as GitHub Copilot does), the backoff grows without bound.
Evidence
From my logs (~/.local/share/opencode/log/):
173 consecutive retry failures over 2.5 hours (16:46–19:27 UTC on 2026-03-15)
Description
When the upstream LLM provider (in my case GitHub Copilot /
api.githubcopilot.com) returns transient errors, the session processor enters an infinite retry loop with exponential backoff that grows unbounded. There is no maximum retry count, no circuit breaker, and no configurable limit. Sessions become effectively dead for hours.Root Cause Analysis
In
packages/opencode/src/session/processor.ts, theprocess()method has awhile (true)loop. When a retryable error occurs in the catch block:The
attemptcounter increments without limit, and inretry.ts, the delay function when response headers ARE present has no cap:Only the NO-headers path has a 30-second cap (
RETRY_MAX_DELAY_NO_HEADERS). When the upstream sends error responses WITH headers (as GitHub Copilot does), the backoff grows without bound.Evidence
From my logs (
~/.local/share/opencode/log/):github-copilot, model:claude-opus-4.6, endpoint:api.githubcopilot.com/chat/completionsAI_APICallError: Could not relay message upstreamRelated Issues
TimeoutOverflowWarningwhen delay exceeds 32-bit int, but did NOT add a max retry countExpected Behavior
RETRY_MAX_DELAY_NO_HEADERSshould apply universally)maxRetriesandmaxBackoffMsinopencode.jsonprovider configProposed Fix
In
retry.ts:In
processor.ts, inside the catch block:In
retry.tsdelay function, apply cap universally:Environment
curl -fsSL https://opencode.ai/install | bash)github-copilot)