## Problem
In `src/index.ts:356`:
```ts
const cachedStep = redis ? await redis.hgetall(`step:${userFlow}:${step.description}`) : {};
The redis variable is null-checked at the start, but between that check and the hgetall call, Redis could disconnect (or the client could be reset). This is a classic TOCTOU (Time-of-Check-Time-of-Use) race.
If redis is non-null at line 356 but the connection drops by line 538:
await redis.hset(`step:${userFlow}:${step.description}`, cacheData);
the hset call throws an unhandled error, crashing the step execution.
Related
src/redis.ts:34-36 — resetRedis() sets client = null after disconnecting. If called mid-execution (e.g., during test teardown), the dangling reference causes a crash.
Suggested fix
Add try/catch around Redis calls in index.ts, or use a proxy that returns null on connection errors instead of throwing.
Labels:
bug,medium-priority