Skip to content

🪲 BUG-#18: Fix permanent provider fallback across run() calls - #32

Merged
FernandoCelmer merged 2 commits into
masterfrom
feature/18
Aug 15, 2026
Merged

🪲 BUG-#18: Fix permanent provider fallback across run() calls#32
FernandoCelmer merged 2 commits into
masterfrom
feature/18

Conversation

@FernandoCelmer

@FernandoCelmer FernandoCelmer commented Aug 15, 2026

Copy link
Copy Markdown
Member

Description

Fixes permanent provider fallback across run() calls (issue #18). _provider_index and self.provider are reset to the primary at the start of every run() call, so each new user message retries the primary provider first. Fallback stickiness is preserved within a single run() to avoid adding retry delays to every internal tool-call turn while the primary is down.

Motivation and Context

Closes #18. Once the agent fell back to a secondary provider, it stayed on it for the entire process lifetime — even after the primary recovered. This caused unintended permanent use of fallback providers.

Types of changes

  • Bug fix
  • New feature
  • Documentation

Checklist

  • Self-review done
  • Tests added
  • CHANGELOG updated
  • Docs updated

@FernandoCelmer FernandoCelmer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is correct and minimal. Resetting _provider_index and self.provider at the top of run() ensures each new user message gives the primary provider another chance, while fallback stickiness within a single run() (across _complete() turns) is preserved intentionally. The test covers the key invariants — primary is retried on a new run(), provider pointer is correct after recovery, and call counts are exact. No issues found.

@FernandoCelmer FernandoCelmer added the bug Something isn't working label Aug 15, 2026
@FernandoCelmer
FernandoCelmer merged commit afe0235 into master Aug 15, 2026
8 checks passed
@FernandoCelmer
FernandoCelmer deleted the feature/18 branch August 15, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent provider fallback resets _provider_index to the fallback permanently — retries after recovery go to wrong provider

1 participant