mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend): invalidate cache on failed write in append_message_if
Mirror the failure-path invalidation already in append_and_save_message. Without this, a failed cache write leaves stale session data in Redis, which later predicate checks could act on and produce duplicate messages.
This commit is contained in:
@@ -757,6 +757,9 @@ async def append_message_if(
|
||||
await cache_chat_session(session)
|
||||
except Exception as e:
|
||||
logger.warning(f"Cache write failed for session {session_id}: {e}")
|
||||
# Invalidate the stale entry so future reads fall back to DB,
|
||||
# preventing a predicate check from acting on stale state.
|
||||
await invalidate_session_cache(session_id)
|
||||
|
||||
return session
|
||||
|
||||
|
||||
Reference in New Issue
Block a user