fix(app): tolerate partial provider failures in get_all_provider_models()#2936
Open
tivris wants to merge 7 commits intotailcallhq:mainfrom
Open
fix(app): tolerate partial provider failures in get_all_provider_models()#2936tivris wants to merge 7 commits intotailcallhq:mainfrom
tivris wants to merge 7 commits intotailcallhq:mainfrom
Conversation
…ls() The function used .collect::<Result<Vec<_>>>() which fails on the first error, discarding all successful results from other providers. This meant a single stale provider (e.g. Bedrock with expired credentials) would block model fetching for all providers, causing confusing errors after an unrelated provider login. Replace with a loop that collects successes and logs warnings for individual failures. Only returns an error when every configured provider fails, matching the existing docstring contract. Fixes tailcallhq#2935
tusharmath
reviewed
Apr 10, 2026
crates/forge_app/src/app.rs
Outdated
| return Err(err); | ||
| } | ||
|
|
||
| Ok(successes) |
Collaborator
There was a problem hiding this comment.
This implementation was recently changed. The problem was when the API key was invalid and more than one provider was activated the user would not be able to view the models of the invalid provider.
One option that I propose is - we could return a Vec of Result of models and on the UI, first show the error and then print the model selector with the models.
:model
[**:**:**] Error: Something bad happened
MODEL PROVIDER CONTEXT WINDOW
... ... ...
... ... ...
... ... ...
Change get_all_provider_models() to return Vec<Result<ProviderModels>>
so individual provider failures (e.g. stale credentials) are shown to
the user instead of being silently swallowed or failing the entire
operation.
- Errors are written to stderr (preserves --porcelain stdout contract)
- Full error chain shown via alternate Display ({:#})
- All-providers-failed still surfaces as a real error
- Addresses review feedback on tailcallhq#2936
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Updated the implementation per your suggestion.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_all_provider_models()uses.collect::<Result<Vec<_>>>()which fails the entire operation if any single configured provider returns an error. This means a stale credential for one provider (e.g. Bedrock) blocks model fetching for all other providers, causing confusing errors after an unrelated provider login like:The function's docstring already describes the correct behavior (return partial results, only error when all providers fail), but the implementation doesn't match.
This PR replaces the fail-fast collection with a loop that:
tracing::warn!for individual provider failuresFollows the same pattern used in the MCP service connection handler (
forge_services/src/mcp/service.rs).Fixes #2935
Test plan
RUSTFLAGS='-Dwarnings' cargo check -p forge_appcompiles cleancargo test -p forge_apppasses