style: trim orphan toolcall comments

maintainer edit: keep the invariant comments in production code but remove repeated issue background from tests.
This commit is contained in:
chengyongru
2026-06-13 00:05:03 +08:00
committed by Xubin Ren
parent 33e6da14d8
commit d72d0102d9
4 changed files with 5 additions and 30 deletions
+2 -5
View File
@@ -182,11 +182,8 @@ def _save_skip_for_turn(
"""Return the persisted-message append boundary for this turn."""
if internal_continuation_inbound(message_metadata):
return initial_message_count
# ``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.
# build_messages may merge the current message into a same-role history tail.
# Runner-appended messages start at initial_message_count in either shape.
has_standalone_current = initial_message_count > 1 + history_count
if has_standalone_current and not user_persisted_early:
return initial_message_count - 1