mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-02 01:28:38 +00:00
Some checks failed
Cost map pins recheck / rerun-cost-map-guard (push) Has been cancelled
LiteLLM Rust DB / db-queries (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
The REDIS_CIRCUIT_BREAKER_* settings are read once in resolve into Resolution::breaker, like get_env_int and get_env_float read them. A value that does not parse is warned about and keeps its default. Before, a typo failed connect with InvalidBreakerSetting and put every native store on per-process memory while RedisCache kept its default breaker.
3.4 KiB
3.4 KiB
- Turns a
litellm_redis_types::Resolutioninto aRedisClient, the same way for every host. It depends onlitellm-redis-types, never onlitellm-config, so a host that resolves Redis some other way connects the same way.redis-clientstays cloud-agnostic, so credential providers and cloud token sources are built here - The host passes only what it alone can build in
HostServices: the event sink, the HTTP client and the environment lookup. The breaker config comes fromResolution::breaker, whichconfigreads fromREDIS_CIRCUIT_BREAKER_*with Python's fallback, so a bad value keeps the default instead of failing connect. Each cloud source asks its auth crate for one explicit identity, the way the Python SDK builds it:AwsAuthService::default_chain_credentials(botocore's default chain),CredentialSource::application_default(google.auth.default) andAzureIdentity(the class_build_azure_credentialpicks). LiteLLM's provider settings such asAWS_ROLE_NAME,AZURE_AD_TOKENorVERTEXAI_CREDENTIALSbelong to Bedrock, Azure OpenAI and Vertex and never reach those constructors.Auth::Provider(a handle for a Pythoncredential_providerobject) fails at connect with an error naming the key, since no host can supply one yet - Every expiring credential goes through the one refresh loop in
refresh.rs. A cloud source only fetches. Never add a second loop or let a source sleep. The expiry deadline lives only in the publishedLatest::Ready, so expiring it leavesReadyand cannot fire again. Never keep a copy of the deadline in the loop - AWS SDK identity settings must be in the process environment.
aws-configcannot take the host lookup, so config-only overrides for profiles, role/web-identity settings, credentials, files and metadata sources fail before connecting rather than silently using another identity. Equal process/config values are allowed. Bedrock-only settings remain unrelated to Redis - redis-rs subscribes once for the connection handshake and again for re-authentication, so a new connection sends a redundant initial AUTH. Unchanged refreshes do not trigger another AUTH. Do not skip a provider's first or alternating subscriptions, because concurrent connections and retries each need the current token. Removing the initial duplicate requires an upstream connection-level fix
- The loop starts on the first
subscribe(), which redis-rs calls inside its runtime, soconnectis safe off a runtime - A token-only credential (Azure without
REDIS_USERNAME, GCP) is sent asAUTH default <token>, because redis-rs always sends a username with a credentials provider. On Redis 6+ that is the same as Python'sAUTH <token> - Tests for the refresh loop use a fake source and real Redis ACL users. Cloud sources are proven against the live service, unit tests only pin request shapes we own
- Rotation tests must retain the same server-side connection IDs across re-AUTH, then force a reconnect after removing the old user and verify the new identity still works
- Live cloud tests live in
tests/live/. SetLITELLM_REDIS_AWS_LIVE_CONFIG,LITELLM_REDIS_AZURE_LIVE_CONFIGorLITELLM_REDIS_GCP_LIVE_CONFIGto a JSON file containingredissettings andhold_seconds. Set the waiting period from the deployment's token lifetime when checking expiry. Optional fixtures return early when unset, and configured tests run under plaincargo test. An unconfigured run never counts as live proof