The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(tools): unify the tool-error cap on one constant
kshitij39db9d11144c
diff --git a/model_tools.py b/model_tools.pyindex a4ed0c20c57..dda40405b70 100644--- a/model_tools.py+++ b/model_tools.py@@ -704,7 +704,11 @@ _TOOL_ERROR_ROLE_TAG_RE = re.compile(_TOOL_ERROR_FENCE_OPEN_RE = re.compile(r'^\s*```(?:json|xml|html|markdown)?\s*', re.MULTILINE)_TOOL_ERROR_FENCE_CLOSE_RE = re.compile(r'\s*```\s*$', re.MULTILINE)_TOOL_ERROR_CDATA_RE = re.compile(r'<!\[CDATA\[.*?\]\]>', re.DOTALL)-_TOOL_ERROR_MAX_LEN = 2000+# Single home for the tool-error context cap: tools/registry.py. Both this+# sanitizer (exception paths) and the dispatch-boundary bounding+# (tool_error / _bound_json_error_result) trim to the same budget so text+# never passes two different caps with two different markers.+from tools.registry import _MAX_TOOL_ERROR_CHARS as _TOOL_ERROR_MAX_LENdef _sanitize_tool_error(error_msg: str) -> str: