Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(session): anchor save boundary to prompt prefix size (#4006)
tangtaizhong666ac5e84d45345
diff --git a/nanobot/session/turn_continuation.py b/nanobot/session/turn_continuation.pyindex 17c8e237b..6ebfaaa7e 100644--- a/nanobot/session/turn_continuation.py+++ b/nanobot/session/turn_continuation.py@@ -182,7 +182,15 @@ def _save_skip_for_turn("""Return the persisted-message append boundary for this turn."""if internal_continuation_inbound(message_metadata):return initial_message_count- return 1 + history_count + (1 if user_persisted_early else 0)+ # ``build_messages`` merges the current message into the last history+ # entry when both share a role, so the prompt prefix is not always+ # ``2 + history_count``. Runner-appended messages always start at+ # ``initial_message_count``; only step back when the current message+ # exists as a standalone entry that was not persisted early.+ has_standalone_current = initial_message_count > 1 + history_count+ if has_standalone_current and not user_persisted_early:+ return initial_message_count - 1+ return initial_message_countdef _goal_continuation_available(