fix(agent): serialize session inbox processing

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-17 22:18:38 +08:00
1 parent 56f7afcfe4
commit 4e2173c9eb
7 files changed
+486 -359

No files matched your search

+14 -6
View File
@@ -138,7 +138,20 @@ class TestMessageToolSuppressLogic:
LLMResponse(content="", tool_calls=[]),
LLMResponse(content="", tool_calls=[]),
])
loop.provider.chat_stream_with_retry = AsyncMock(side_effect=lambda *a, **kw: next(calls))
pending_queue: asyncio.Queue[InboundMessage] = asyncio.Queue()
async def next_response(*_args, **_kwargs):
response = next(calls)
if response.content == "First answer":
pending_queue.put_nowait(InboundMessage(
channel="feishu",
sender_id="user1",
chat_id="chat123",
content="follow-up",
))
return response
loop.provider.chat_stream_with_retry = AsyncMock(side_effect=next_response)
loop.tools.get_definitions = MagicMock(return_value=[])
sent: list[OutboundMessage] = []
@@ -146,11 +159,6 @@ class TestMessageToolSuppressLogic:
if isinstance(mt, MessageTool):
mt.set_send_callback(AsyncMock(side_effect=lambda m: sent.append(m)))
pending_queue = asyncio.Queue()
await pending_queue.put(
InboundMessage(channel="feishu", sender_id="user1", chat_id="chat123", content="follow-up")
)
msg = InboundMessage(channel="feishu", sender_id="user1", chat_id="chat123", content="Start")
result = await loop._process_message(msg, pending_queue=pending_queue)