Bug fix for Redis TypeError (#2411)

This commit is contained in:
Evan Mattson
2025-11-24 19:48:33 +09:00
committed by GitHub
Unverified
parent f0f1051c7d
commit f9a94ce7b5
3 changed files with 49 additions and 0 deletions
@@ -495,3 +495,20 @@ class TestRedisChatMessageStore:
# Verify rpush was called for each message
pipeline_mock = mock_redis_client.pipeline.return_value.__aenter__.return_value
assert pipeline_mock.rpush.call_count >= 2
async def test_serialize_with_agent_thread(self, redis_store, sample_messages):
"""Test that RedisChatMessageStore can be serialized within an AgentThread.
This test verifies the fix for issue #1991 where calling thread.serialize()
with a RedisChatMessageStore would fail with "Messages should be a list" error.
"""
from agent_framework import AgentThread
thread = AgentThread(message_store=redis_store)
await thread.on_new_messages(sample_messages)
serialized = await thread.serialize()
assert serialized is not None
assert "chat_message_store_state" in serialized
assert serialized["chat_message_store_state"] is not None