Skip to content

LLM retry has no max attempts: stream errors cause infinite retry loop, UI stuck on Thinking #41848

Description

@teran-netizen

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 selected immediately after stream 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

Activity

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

Metadata

Metadata

Assignees

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