MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _tool_result_failure_kind

Function _tool_result_failure_kind

uncommon_route/proxy.py:1382–1400  ·  view source on GitHub ↗

Classify a tool failure by what the next routing step should optimize. Semantic failures are evidence about the patch or answer quality. Environment/invocation failures are operational noise: keep them visible as high-risk, but do not let them masquerade as complex reasoning failures.

(text: str, command: str = "")

Source from the content-addressed store, hash-verified

1380
1381
1382def _tool_result_failure_kind(text: str, command: str = "") -> str:
1383 """Classify a tool failure by what the next routing step should optimize.
1384
1385 Semantic failures are evidence about the patch or answer quality.
1386 Environment/invocation failures are operational noise: keep them visible as
1387 high-risk, but do not let them masquerade as complex reasoning failures.
1388 """
1389 if not text:
1390 return ""
1391 haystack = f"{command}\n{text}".lower()
1392 if _contains_environment_recovery_signal(text, command):
1393 return "environment"
1394 if any(marker in haystack for marker in _INVOCATION_FAILURE_MARKERS):
1395 return "invocation"
1396 if _contains_tool_failure_signal(text, command):
1397 if _has_verification_context(text, command) or _NONZERO_FAILURE_SUMMARY_RE.search(text):
1398 return "semantic"
1399 return "unknown"
1400 return ""
1401
1402
1403def _tool_result_is_routine_success(text: str, is_error: bool, command: str) -> bool:

Callers 1

Tested by

no test coverage detected