Skip to content

fix(cron): fall back to auto-detect provider when explicit provider fails - #4127

Closed
GratefulDave wants to merge 1 commit into
NousResearch:mainfrom
GratefulDave:feat/cron-model-fallback
Closed

fix(cron): fall back to auto-detect provider when explicit provider fails#4127
GratefulDave wants to merge 1 commit into
NousResearch:mainfrom
GratefulDave:feat/cron-model-fallback

Conversation

@GratefulDave

Copy link
Copy Markdown
Contributor

Problem

When a cron job's configured provider (from config.yaml model.provider or HERMES_INFERENCE_PROVIDER env) has no valid credentials — e.g. the config references anthropic but ANTHROPIC_API_KEY is not set — the job fails immediately with an AuthError. 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 with requested="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:

Job my-job: provider resolution failed (No Anthropic credentials found), falling back to auto-detect

If auto-detection also fails, the original hard error is preserved.

Testing

  • Cron job with config.yaml pointing to anthropic but no Anthropic key: previously failed, now falls back to auto-detecting a working provider
  • Cron job with valid explicit provider: no change in behavior
  • Cron job with no configured provider at all: already uses auto, no change

…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.
@GratefulDave

Copy link
Copy Markdown
Contributor Author

Closing — needs a fresh rebase against current main. Will resubmit if still relevant.

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.

2 participants