fix: refresh queued conversation history under the session lock (#10238)

* fix: refresh queued conversation history under the session lock

* style: format queued conversation history refresh

* Delete tests/unit/test_queued_conversation_history.py

---------

Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
This commit is contained in:
PeiPei233
2026-09-27 10:52:32 +08:00
committed by GitHub
co-authored by Soulter
parent 0c99963480
commit 2b6b31a013
+16 -1
View File
@@ -1440,7 +1440,22 @@ async def collect_initial_request(
list(req.contexts) if isinstance(req.contexts, list) else req.contexts
)
if req.conversation:
req.contexts = json.loads(req.conversation.history)
# Handler requests can be prepared before the pipeline acquires
# the session lock. Reload the bound conversation here so queued
# turns include replies saved while they were waiting.
conversation = (
await plugin_context.conversation_manager.get_conversation(
event.unified_msg_origin, req.conversation.cid
)
)
if conversation is None:
_set_llm_error_message(
event,
"The requested conversation no longer exists. Please send a new message.",
)
return None, None
req.conversation = conversation
req.contexts = json.loads(conversation.history)
else:
req = ProviderRequest()
req.prompt = ""