Skip to content

fix: flush in-memory chat history buffer to Redis on recovery#65

Merged
agarg5 merged 1 commit intomainfrom
fix/chat-history-fallback-flush
Mar 2, 2026
Merged

fix: flush in-memory chat history buffer to Redis on recovery#65
agarg5 merged 1 commit intomainfrom
fix/chat-history-fallback-flush

Conversation

@agarg5
Copy link
Owner

@agarg5 agarg5 commented Mar 2, 2026

Summary

  • When Redis has a transient connection failure, chat messages fall back to in-memory storage. Previously, once Redis recovered, those buffered messages were invisible — causing chat history to intermittently show only some messages on page refresh.
  • Added _flush_fallback() method that replays buffered messages to Redis via pipeline when the connection recovers, called from both append_message() and get_history().
  • Fixed clear_history() to always clear the in-memory fallback buffer alongside Redis.

Test plan

  • All 251 existing tests pass
  • Verify chat history persists consistently across page refreshes on Railway

🤖 Generated with Claude Code

When Redis has a transient failure, messages stored in the in-memory
fallback were invisible on subsequent reads once Redis recovered,
causing chat history to intermittently show only some messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@agarg5 agarg5 merged commit 5e8a761 into main Mar 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant