The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(sanitizer): drop duplicated legacy _classify_tool_call_orphans left by cherry-pick auto-merge
Hermes Agent225fa13bd3f5
diff --git a/agent/agent_runtime_helpers.py b/agent/agent_runtime_helpers.pyindex 929c84b7607..c0bed771f54 100644--- a/agent/agent_runtime_helpers.py+++ b/agent/agent_runtime_helpers.py@@ -3741,46 +3741,6 @@ def repair_empty_non_final_messages(return messages-def _classify_tool_call_orphans(- messages: List[Dict[str, Any]],-) -> tuple:- """Return (surviving_call_ids, result_call_ids, orphaned_results, missing_results).-- Collects tool-call IDs from both assistant ``tool_calls`` (using the- ``call_id || id`` resolution that ``_get_tool_call_id_static`` uses)- and from ``tool`` messages, then classifies orphans:-- - ``orphaned_results``: tool messages whose ``tool_call_id`` has no- matching assistant tool_call in the window.- - ``missing_results``: assistant tool_calls whose results were dropped- (no matching ``tool`` message found).-- This is the single source of truth for orphan detection. The caller- decides whether to insert stubs (pre-API sanitizer) or strip orphans- (context compressor) — but the *detection* logic is shared so dedup- and id-resolution rules never drift between the two sites (#58357).- """- surviving_call_ids: set = set()- for msg in messages:- if msg.get("role") == "assistant":- for tc in msg.get("tool_calls") or []:- cid = _ra().AIAgent._get_tool_call_id_static(tc)- if cid:- surviving_call_ids.add(cid)-- result_call_ids: set = set()- for msg in messages:- if msg.get("role") == "tool":- cid = (msg.get("tool_call_id") or "").strip()- if cid:- result_call_ids.add(cid)-- orphaned_results = result_call_ids - surviving_call_ids- missing_results = surviving_call_ids - result_call_ids- return surviving_call_ids, result_call_ids, orphaned_results, missing_results---def _classify_tool_call_orphans(messages: List[Dict[str, Any]]):"""Classify orphaned tool-call / tool-result pairs in *messages*.