Skip to content

fix(opencode): cap retry attempts at 5 to prevent infinite loops#29047

Open
niStee wants to merge 1 commit into
anomalyco:devfrom
niStee:fix/cap-retry-attempts
Open

fix(opencode): cap retry attempts at 5 to prevent infinite loops#29047
niStee wants to merge 1 commit into
anomalyco:devfrom
niStee:fix/cap-retry-attempts

Conversation

@niStee
Copy link
Copy Markdown

@niStee niStee commented May 23, 2026

Issue for this PR

Closes #29143

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Prevents infinite retry loops when a provider consistently fails by capping retry attempts at 5. This ensures the fallback system can proceed to the next configured model instead of spinning indefinitely on a broken provider.

How did you verify your code works?

Tested locally by simulating a consistent provider failure and verifying that the retry loop breaks after 5 attempts, correctly returning an exhaustion status to the caller.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found related PRs that address retry logic and capping attempts:

Potential Related PRs:

  1. PR fix(session): retry network errors, cap at 3, add retry_exhausted status #28792 - fix(session): retry network errors, cap at 3, add retry_exhausted status

  2. PR fix(session): cap retry schedule at RETRY_MAX_ATTEMPTS = 3 #26369 - fix(session): cap retry schedule at RETRY_MAX_ATTEMPTS = 3

Why they're related: All three PRs address preventing infinite retry loops by introducing caps on retry attempts. PR #29047 appears to be addressing the same problem at a different layer (opencode vs session) with a higher cap (5 vs 3). You may want to check if these efforts should be coordinated or if they're addressing different retry mechanisms.

@niStee niStee force-pushed the fix/cap-retry-attempts branch from 597160e to fa90a0f Compare May 24, 2026 01:35
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Infinite retry loop on consistent provider failure

1 participant