fix: prevent duplicate user message on session recovery re-publish
The re-published last user message was persisted into session history a second time when the agent loop processed it, duplicating the user's input. Mark the re-published InboundMessage with SKIP_USER_PERSIST_META so should_persist_user_message() and _save_skip_for_turn() treat it as already-persisted.
This commit is contained in:
@@ -2151,6 +2151,12 @@ class AgentLoop:
|
||||
sender_id=chat_id,
|
||||
chat_id=chat_id,
|
||||
content=last_user_msg["content"],
|
||||
# The message already exists in session history
|
||||
# (persisted before the crash); skip persisting it
|
||||
# again so recovery does not duplicate it.
|
||||
metadata={
|
||||
turn_continuation.SKIP_USER_PERSIST_META: True
|
||||
},
|
||||
)
|
||||
)
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user