fix(utils): remove unreachable dead code in find_legal_message_start

The for loop at line 168 never executes because start is assigned
i + 1 immediately before slicing messages[start : i + 1], which
is always an empty list. Remove the dead code.

Fixes #3716
This commit is contained in:
chengyongru 2026-05-09 17:37:32 +08:00 committed by Xubin Ren
parent de13e72e15
commit 73a8d8a875

View File

@ -165,11 +165,6 @@ def find_legal_message_start(messages: list[dict[str, Any]]) -> int:
if tid and str(tid) not in declared:
start = i + 1
declared.clear()
for prev in messages[start : i + 1]:
if prev.get("role") == "assistant":
for tc in prev.get("tool_calls") or []:
if isinstance(tc, dict) and tc.get("id"):
declared.add(str(tc["id"]))
return start