Describe the bug
If cache.model.redis.url (or REDIS_URL) is set but Redis is unreachable at startup, GoModel fails to start entirely instead of falling back to the local file cache or starting in a degraded mode. This makes Redis a hard single point of failure for the whole gateway, even though a local cache backend already exists and works fine on its own.
Root cause: initCache (internal/providers/init.go, around lines 187-219) only tries the Redis branch when m.Redis.URL != "" and returns the connection error straight up (return nil, err at line 201) with no fallback to m.Local, even when a local cache config is also present. This error propagates up through provider initialization and the whole application fails to start (failed to initialize application: failed to initialize providers: failed to initialize cache: failed to connect to redis: ...).
This also affects the response cache path (cache.response.simple) - see internal/responsecache/responsecache.go, which currently only warns (not hard-fails) when the URL is missing entirely, but its behavior on a configured-but-unreachable Redis at runtime (after startup, mid-operation) has not been separately audited here and may need its own look once the startup path is fixed.
GoModel version
v0.1.68 (HEAD around 9d54827, 2026-08-03)
Steps To Reproduce
- Set
REDIS_URL to a Redis instance that is not running/reachable.
- Start GoModel.
- Observe: the process logs
redis: connection pool: failed to dial after 5 attempts several times, then ERROR failed to initialize application error="failed to initialize providers: failed to initialize cache: failed to connect to redis: ..." and exits/fails to serve any traffic at all.
Screenshots/Logs
{"level":"WARN","msg":"redis: connection pool: failed to dial after 5 attempts: dial tcp [::1]:6379: connect: connection refused"}
{"level":"ERROR","msg":"failed to initialize application","error":"failed to initialize providers: failed to initialize cache: failed to connect to redis: dial tcp [::1]:6379: connect: connection refused"}
Additional context
This is a bigger design task, not a one-line fix:
- Decide the desired behavior: fall back to the local file cache when Redis is configured but unreachable at startup (with a clear warning log), rather than a hard failure.
- Handle the case where Redis becomes unreachable later, at runtime (after a successful startup) - reconnect handling, not just a one-time startup check.
- Apply the same graceful-degradation thinking to the other Redis-backed features (response cache, semantic cache) for consistency, even though this issue is scoped primarily at the model-cache startup failure described above.
- Needs tests covering: Redis unreachable at startup with local cache configured (should start successfully in degraded mode), Redis unreachable with no local cache configured (should still fail clearly, since there is genuinely no cache backend available), and Redis recovering after being down.
Describe the bug
If
cache.model.redis.url(orREDIS_URL) is set but Redis is unreachable at startup, GoModel fails to start entirely instead of falling back to the local file cache or starting in a degraded mode. This makes Redis a hard single point of failure for the whole gateway, even though a local cache backend already exists and works fine on its own.Root cause:
initCache(internal/providers/init.go, around lines 187-219) only tries the Redis branch whenm.Redis.URL != ""and returns the connection error straight up (return nil, errat line 201) with no fallback tom.Local, even when a local cache config is also present. This error propagates up through provider initialization and the whole application fails to start (failed to initialize application: failed to initialize providers: failed to initialize cache: failed to connect to redis: ...).This also affects the response cache path (
cache.response.simple) - see internal/responsecache/responsecache.go, which currently only warns (not hard-fails) when the URL is missing entirely, but its behavior on a configured-but-unreachable Redis at runtime (after startup, mid-operation) has not been separately audited here and may need its own look once the startup path is fixed.GoModel version
v0.1.68 (HEAD around 9d54827, 2026-08-03)
Steps To Reproduce
REDIS_URLto a Redis instance that is not running/reachable.redis: connection pool: failed to dial after 5 attemptsseveral times, thenERROR failed to initialize application error="failed to initialize providers: failed to initialize cache: failed to connect to redis: ..."and exits/fails to serve any traffic at all.Screenshots/Logs
Additional context
This is a bigger design task, not a one-line fix: