GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Add configurable max retry limit for SessionRetry mechanism · Issue #26675 · anomalyco/opencode

feat: Add configurable max retry limit for SessionRetry mechanism #26675

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
feat: Add configurable max retry limit for SessionRetry mechanism#26675
Copy link
Assignees
jlongster

Description

@Fatty911
Fatty911
opened on May 10, 2026
Issue body actions

Problem

When a provider returns persistent 5xx errors (e.g., 500 Internal Server Error), the built-in SessionRetry mechanism retries indefinitely with exponential backoff. This can lead to extremely long wait times (hours) without any way to configure a maximum retry count.

Observed Behavior

When DeepSeek-V4-Pro returns a 500 error, OpenCode retries with exponential backoff:

  • Attempt 1: 2s delay
  • Attempt 5: 32s delay
  • Attempt 10: ~17min delay
  • Attempt 13: ~2h 11min delay
  • ...continues indefinitely

The retry mechanism has:

  • RETRY_INITIAL_DELAY = 2000ms
  • RETRY_BACKOFF_FACTOR = 2
  • RETRY_MAX_DELAY = 2147483647ms (~24.8 days)
  • No maximum retry count limit

Code Reference

The retry policy in SessionProcessor uses Effect's n.retry(cr.policy({...})) which has no configurable max attempts. The maxRetries: d.retries ?? 0 only applies to the Vercel AI SDK layer, not the Effect retry policy.

Proposed Solution

Add a configurable maximum retry limit to the SessionRetry mechanism:

// opencode.json
{
  "session": {
    "retry": {
      "maxAttempts": 5,  // Stop retrying after 5 attempts
      "maxDelay": 30000  // Optional: cap max delay at 30s
    }
  }
}

Or per-agent configuration:

{
  "agent": {
    "build": {
      "retry": {
        "maxAttempts": 5
      }
    }
  }
}

Use Cases

  1. Provider outages: When a provider is down for extended periods, users should be able to set a limit and let fallback mechanisms (like model switching plugins) take over
  2. Cost control: Prevent extremely long retry loops that consume time/resources
  3. User experience: Users can set reasonable limits and manually intervene when needed

Current Workaround

None. Users must manually abort sessions when retries become excessive. Plugin-based fallback systems (like oh-my-openagent) can switch models but cannot control OpenCode's internal retry count.

Environment

  • OpenCode version: latest (binary)
  • Platform: Linux
  • Provider: DeepSeek-V4-Pro (direct API)

Activity

  1. github-actions
    assigned
    jlongster
    on May 10, 2026
  2. github-actions commented on May 10, 2026

    @github-actions
    github-actionsBot
    on May 10, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Feature request titles should start with [FEATURE]: (current title uses feat: prefix)
    • The feature request template requires a verification checkbox confirming you've searched for existing issues

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    • [Bug]: Session processor retries indefinitely with unbounded exponential backoff — no max retries or circuit breaker #17648: Session processor retries indefinitely with unbounded exponential backoff — no max retries or circuit breaker
    • fix(session): SessionRetry.policy() retries forever with no max attempt count #21960: SessionRetry.policy() retries forever with no max attempt count
    • Session retry loops forever — no max attempt cap or configurable limit #25733: Session retry loops forever — no max attempt cap or configurable limit
    • [Feature Request] Configurable Retry Mechanism via opencode.json #3011: Configurable Retry Mechanism via opencode.json (closed)

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. github-actions
    added
    needs:complianceThis means the issue will auto-close after 2 hours.
    on May 10, 2026
  4. Fatty911
    added a commit that references this issue on May 10, 2026

    feat: add configurable max retry limit for SessionRetry

    This issue will close once commit 84cdaf8 is merged into the 'dev' branch.
    84cdaf8
  5. github-actions commented on May 10, 2026

    @github-actions
    github-actionsBot
    on May 10, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

  6. github-actions
    removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on May 10, 2026
  7. github-actions
    closed this as not plannedon May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jlongster
    jlongster

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.