From 73a8d8a8755aa5af422d3217c281f795580bb4b2 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Sat, 9 May 2026 17:37:32 +0800 Subject: [PATCH] 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 --- nanobot/utils/helpers.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nanobot/utils/helpers.py b/nanobot/utils/helpers.py index b047e24d2..0655b4439 100644 --- a/nanobot/utils/helpers.py +++ b/nanobot/utils/helpers.py @@ -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