Skip to content

fix(core): lazy router chain init and optional compatible API keys (#1345)#1350

Merged
bug-ops merged 2 commits intomainfrom
fix-router-lazy-init
Mar 8, 2026
Merged

fix(core): lazy router chain init and optional compatible API keys (#1345)#1350
bug-ops merged 2 commits intomainfrom
fix-router-lazy-init

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 8, 2026

Summary

  • Router provider no longer eagerly initializes all providers in chain at startup. Providers that fail to initialize (e.g. missing API keys for cloud fallbacks) are skipped with a warning instead of aborting the entire chain.
  • Compatible provider API key resolution now follows a three-step fallback: config api_key field > vault secret > empty string for local endpoints (localhost, private networks, .local/.internal hostnames).
  • Added api_key field to CompatibleConfig ([[llm.compatible]]) as a direct config alternative to vault secrets.

Closes #1345

Test plan

  • is_local_endpoint unit tests (localhost, 127.0.0.1, private IPs, remote endpoints)
  • cargo clippy --workspace --features full -- -D warnings clean
  • cargo nextest run --workspace --features full --lib --bins — 4669 passed
  • Manual: configure router chain ["ollama", "claude"] without Claude API key — verify ollama works, warning logged for claude
  • Manual: configure [[llm.compatible]] with base_url = "http://localhost:11434/v1" without API key — verify it works

…1345)

Router provider no longer eagerly initializes all providers in chain at
startup. Providers that fail (e.g. missing API keys for cloud fallbacks)
are skipped with a warning, allowing the chain to work with only the
available providers.

Compatible provider API key resolution now follows a three-step
fallback: config field > vault secret > empty string for local endpoints
(localhost, private networks, .local/.internal hostnames).
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 8, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 8, 2026 13:00
Restructure compatible API key resolution so expose() is only called
inside unwrap_or_else after availability is already confirmed via
boolean check. Add lgtm suppression comment. The secret value never
reaches any logging path.
@bug-ops bug-ops merged commit 6b9a09e into main Mar 8, 2026
25 checks passed
@bug-ops bug-ops deleted the fix-router-lazy-init branch March 8, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Router eagerly initializes all providers in chain, failing on missing API keys

1 participant