mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-26 22:42:23 +02:00
[eric] agents: after a mid-stream stop, rebuild history from session.messages so resume/follow-ups see the partial reply
This commit is contained in:
@@ -3132,6 +3132,14 @@ class AgentManager:
|
||||
logger.exception("auto-continuation dispatch failed")
|
||||
except asyncio.CancelledError:
|
||||
session.status = "stopped"
|
||||
# A cancelled turn desyncs the CLI's resume transcript from
|
||||
# session.messages: the SDK never recorded the interrupted turn,
|
||||
# so resuming that sdk_session_id replays a history with no trace
|
||||
# of the stopped reply and the model insists it wrote nothing
|
||||
# ("nothing to continue"). Force the next turn (resume OR a fresh
|
||||
# message) to rebuild history from session.messages so the model
|
||||
# sees the same conversation the user does.
|
||||
session.needs_fresh_session = True
|
||||
# Stopped mid-stream. The SDK's commit envelope never arrives on
|
||||
# cancel, so persist whatever text already streamed; otherwise the
|
||||
# reply the user just watched appear vanishes (the frontend wipes
|
||||
|
||||
Reference in New Issue
Block a user