anomalyco / anomalyco/opencode
LLM retry has no max attempts: stream errors cause infinite retry loop, UI stuck on Thinking
Open
@jlongster is already working on this.
Since Aug 11, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
LLM retry has no maximum attempt limit. RETRY_MAX_DELAY is set to 2147483647ms (~24 days). When DeepSeek returns a stream error, the retry loop continues indefinitely — the UI shows "Thinking..." forever with no error feedback.
Evidence
- 5 processes died on
llm runtime selectedimmediately afterstream error - RETRY_MAX_DELAY = 2147483647 (should be ~30 seconds for typical API retries)
- No RETRY_MAX_ATTEMPTS constant exists
- retryable() matches stream errors against patterns like
/stream/and/error/— always retryable - RETRY_MAX_DELAY_NO_HEADERS = 30000 exists but only applies when no response headers present
- With response headers, cap is full RETRY_MAX_DELAY (24 days)
Code location
File: retry.ts (bundled in main chunk)
RETRY_MAX_DELAY = 2147483647 // ~24 days — effectively unlimited
RETRY_MAX_DELAY_NO_HEADERS = 30000 // only used without headers
// RETRY_MAX_ATTEMPTS is MISSING
function policy2(opts) {
return fromStepWithMetadata(succeed((meta3) => {
const error50 = opts.parse(meta3.input);
const retry6 = retryable(error50, opts.provider);
if (!retry6) return done(meta3.attempt); // only stops if NOT retryable
// continues forever otherwise
}));
}
Expected behavior
After N attempts (e.g., 3-5), emit a providerError event and stop — let the UI show an error instead of eternal "Thinking..."
Version: 1.18.16, Electron 42.3.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.