Skip to content

[Bug]: Infinite retry loop on consistent provider failure #29143

@niStee

Description

@niStee

Description

The fallback system can spin in an infinite retry loop when a provider consistently fails. We should cap retry attempts (e.g. at 5) so the fallback system can proceed to the next configured model instead of spinning indefinitely.

Steps to Reproduce

  1. Configure a provider that consistently fails (e.g., due to network error or repeated 500 responses).
  2. Trigger the fallback system to use this provider.
  3. Observe the session logs showing an infinite retry loop without proceeding to the next configured model.

Expected Behavior

The retry loop should be capped at a reasonable limit (e.g., 5 attempts). Once the limit is reached, it should return an exhaustion status so the system can proceed to the next fallback model.

Environment

  • OS: Any
  • OpenCode version: dev
  • Provider/model: Any consistently failing provider

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions