feat: harden the Redis connection for distributed runs - #24
Merged
Conversation
SpecBandit's Redis is a best-effort coordinator for a distributed run, but CI runners can sit a WAN hop away from it (e.g. a cross-datacenter Kilo mesh). A transient blip was reddening spec shards with `[specbandit] Redis error: ...` even though the Redis server was healthy — the connect just timed out over the inter-DC tunnel. Mirrors the same change in the Ruby gem. - Explicit client resilience: give ioredis connectTimeout, commandTimeout and a bounded retryStrategy instead of relying on defaults. - Larger, configurable retry budget: MAX_RETRIES default raised 3 -> 5 and made env/flag-driven (SPECBANDIT_REDIS_MAX_ATTEMPTS / --redis-max-attempts), with capped (10s) exponential backoff so short blips are ridden out. Bumps the package to 1.1.0.
beagleknight
force-pushed
the
feat/redis-resilience-fallback
branch
from
July 16, 2026 11:21
4e98fce to
f673ed7
Compare
beagleknight
marked this pull request as ready for review
July 16, 2026 12:34
fcsonline
approved these changes
Jul 16, 2026
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.
Why
Spec shards in
factorialco/factorialCI intermittently fail with[specbandit] Redis error: ...even though the Redis server is healthy — it's a network-path problem. SpecBandit's shared Redis lives in one datacenter (Kilo locationhel), and ~1/3 of runners now sit in another DC (fsn1) reaching it over an inter-DC WireGuard tunnel (~29 ms vs ~5 ms intra-DC). A transient blip exhausts SpecBandit's short retry budget and the CLI exits non-zero, reddening the build.Mirrors the same change in the Ruby gem (
factorialco/specbandit); the two implementations are used together in CI (push= JS,work= Ruby gem) and share the sameRedisQueue/ retry shape.What
Harden the Redis connection so short blips are ridden out instead of failing the run:
redisQueue.ts):new Redis(url, …)now setsconnectTimeout,commandTimeout, and a boundedretryStrategyinstead of relying on defaults.configuration.ts,redisQueue.ts):MAX_RETRIESdefault 3 → 5, env/flag-driven (SPECBANDIT_REDIS_MAX_ATTEMPTS/--redis-max-attempts), with capped (10s) exponential backoff.No behavioural change when Redis is reachable; on a hard outage the CLI still exits non-zero as before.
Notes for review
jestAdapter/cypressAdapter"not installed" assertions fail locally because those peer deps are installed in the devnode_modules— unrelated to this change (verified on the untouched tree).Tests
typecheckclean; suites pass (redisQueue,worker,configuration,publisher,cliAdapter,e2e-key-failed). Added connection-option, env-config (seconds → ms), and configurable-retry (incl. custommaxAttempts) coverage.Draft for review.