Repository navigation
Conversation
The Redis client had no "error" listener and the backend has no uncaughtException handler. node-redis emits "error" when the connection drops and on every failed reconnect, so when Redis restarted (it was OOM-killed on Oct 22) Node treated it as an uncaught exception and every backend pod exited at once, taking the API down until Redis and the pods came back. Create the client in lib/redis-client.ts with an "error" listener that logs (at most every 10 seconds, with a count of skipped errors) and lets node-redis reconnect; commands wait in its offline queue meanwhile. Also log when the connection is ready. The new test drops a fake Redis server and brings it back on the same port: the process survives and the client reconnects. Without the listener the test fails with the same unhandled 'error' event. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0132twi4SNP1UzsCZvrPLhy6
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
Problem
When Redis goes down, the backend crashes with it.
apps/backend/src/bootstrap/loaders/redis.ts) has noerrorlistener, and the backend has nouncaughtExceptionhandler. node-redis emitserrorwhen the connection drops and on every failed reconnect attempt. With no listener, Node treats that as an uncaught exception and the process exits.Unhandled 'error' event: SocketClosedUnexpectedlyError.Change
apps/backend/src/lib/redis-client.ts: creates the client with anerrorlistener that logs and lets node-redis reconnect on its own.bootstrap/loaders/redis.tsnow uses it. It lives inlib/becauseconfig.tsrequires about 20 env vars, which would make the loader hard to test.Testing
src/lib/redis-client.test.ts: starts a fake Redis, connects, drops the connection and closes the port (as an OOM kill would), then brings the server back on the same port. The process survives and the client reconnects.failureType: 'uncaughtException'(Socket closed unexpectedly), and the test run exits instead of hanging.npm testinapps/backend: 9/9 pass.tscreports the same 250 errors asmain, none in these files. They come from GraphQL types that weren't generated locally.Not covered
maxmemoryand a 512Mi limit forbt-prod-redis).Generated by Claude Code