fix(cron): fall back to auto-detect provider when explicit provider fails - #4127
Closed
GratefulDave wants to merge 1 commit into
Closed
fix(cron): fall back to auto-detect provider when explicit provider fails#4127GratefulDave wants to merge 1 commit into
GratefulDave wants to merge 1 commit into
Conversation
…ails When a cron job's configured provider (from config.yaml or env) has no valid credentials (e.g. ANTHROPIC_API_KEY not set), the job would fail immediately with an AuthError. This adds a fallback: if the explicit provider fails, retry with requested='auto' to find any working provider before giving up.
Contributor
Author
|
Closing — needs a fresh rebase against current main. Will resubmit if still relevant. |
19 tasks
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.
Problem
When a cron job's configured provider (from
config.yamlmodel.provider orHERMES_INFERENCE_PROVIDERenv) has no valid credentials — e.g. the config referencesanthropicbutANTHROPIC_API_KEYis not set — the job fails immediately with anAuthError. The entire cron run is lost.This is especially painful after initial setup where config.yaml may contain a default or stale provider that doesn't match the available credentials.
Fix
When
resolve_runtime_provider()raises for the explicitly configured provider, catch the exception and retry withrequested="auto"to find any working provider before giving up.The original error is logged as a warning, so operators can see that a fallback occurred and fix the config:
If auto-detection also fails, the original hard error is preserved.
Testing
config.yamlpointing toanthropicbut no Anthropic key: previously failed, now falls back to auto-detecting a working provider