Skip to content

Commit f615b62

Browse files
committed
Release 0.7.14 routing failure recovery
1 parent 8beb750 commit f615b62

11 files changed

Lines changed: 1478 additions & 52 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ htmlcov/
3636

3737
# Node (openclaw-plugin)
3838
openclaw-plugin/node_modules/
39+
node_modules/
40+
41+
# Local run artifacts
42+
logs/
43+
tmp/
44+
test-results/
45+
tests/screenshots/
3946

4047
# Spend control local data
4148
spending.json

openclaw-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@anjieyang/uncommon-route",
3-
"version": "0.7.13",
3+
"version": "0.7.14",
44
"description": "OpenClaw plugin for UncommonRoute, the local LLM router that cuts premium-model spend",
55
"type": "module",
66
"main": "src/index.js",

openclaw-plugin/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import { spawn, execSync } from "node:child_process";
1717
import { setTimeout as sleep } from "node:timers/promises";
1818

19-
const VERSION = "0.7.13";
19+
const VERSION = "0.7.14";
2020
const DEFAULT_PORT = 8403;
2121
const DEFAULT_UPSTREAM = "";
2222
const HEALTH_TIMEOUT_MS = 15_000;

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uncommon-route"
3-
version = "0.7.13"
3+
version = "0.7.14"
44
description = "Local LLM router that cuts premium-model spend with adaptive 3-tier routing, OpenAI + Anthropic compatible"
55
requires-python = ">=3.11"
66
license = "MIT"

tests/test_quality_routing.py

Lines changed: 142 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ class DummyBenchmarkCache:
12271227
def get_all_qualities(self, models):
12281228
return {
12291229
"anthropic/claude-opus-4.6": 0.801,
1230-
"minimax/minimax-m2.7": 0.676,
1230+
"minimax/minimax-m2.7": 0.600,
12311231
}
12321232

12331233
monkeypatch.setattr(benchmark, "get_benchmark_cache", lambda: DummyBenchmarkCache())
@@ -1798,6 +1798,7 @@ def test_long_tool_trajectory_records_agent_pressure() -> None:
17981798

17991799
@pytest.mark.parametrize("tool_output", [
18001800
"FAILED tests/test_router.py::test_route - AssertionError",
1801+
"Final verification:\n n=66: FAIL\n n=67: OK",
18011802
"11 passed, 1 error in 0.42s",
18021803
"Command failed with exit code 1",
18031804
"Process completed with exit code 1.",
@@ -1836,6 +1837,38 @@ def test_common_failed_tool_summaries_are_high_risk(tool_output: str) -> None:
18361837
assert features.tier_cap is None
18371838

18381839

1840+
def test_plain_fail_status_without_validation_context_is_not_high_risk() -> None:
1841+
from uncommon_route.proxy import _classify_step, _extract_routing_features
1842+
1843+
body = {
1844+
"messages": [
1845+
{"role": "user", "content": "Inspect service status."},
1846+
{
1847+
"role": "assistant",
1848+
"content": None,
1849+
"tool_calls": [
1850+
{"type": "function", "function": {"name": "bash", "arguments": "{}"}},
1851+
],
1852+
},
1853+
{"role": "tool", "content": "<returncode>0</returncode>\n<output>Status: FAIL\nmanual flag only</output>"},
1854+
],
1855+
"tools": [{"type": "function", "function": {"name": "bash"}}],
1856+
}
1857+
1858+
step_type, tool_names = _classify_step(body)
1859+
features = _extract_routing_features(
1860+
body,
1861+
step_type=step_type,
1862+
tool_names=tool_names,
1863+
prompt="Inspect service status.",
1864+
session_id="session-1",
1865+
)
1866+
1867+
assert features.step_type == "tool-result-followup"
1868+
assert features.step_risk == "normal"
1869+
assert features.tier_floor is None
1870+
1871+
18391872
def test_empty_nonzero_pip_install_result_is_high_risk_but_medium_capped() -> None:
18401873
from uncommon_route.proxy import _classify_step, _extract_routing_features
18411874

@@ -1979,6 +2012,114 @@ def test_missing_dependency_from_test_runner_is_medium_capped() -> None:
19792012
assert features.tier_floor is Tier.MEDIUM
19802013
assert features.tier_cap is Tier.MEDIUM
19812014
assert features.tier_cap_reason == "environment-recovery"
2015+
assert features.verification_failed is False
2016+
assert features.failure_kind == "environment"
2017+
2018+
2019+
def test_wrong_test_label_is_high_risk_but_invocation_capped() -> None:
2020+
from uncommon_route.proxy import _classify_step, _extract_routing_features
2021+
2022+
body = {
2023+
"messages": [
2024+
{"role": "user", "content": "Run the target test."},
2025+
{
2026+
"role": "assistant",
2027+
"content": None,
2028+
"tool_calls": [
2029+
{
2030+
"id": "call-test",
2031+
"type": "function",
2032+
"function": {
2033+
"name": "bash",
2034+
"arguments": (
2035+
'{"command": "cd /testbed && python tests/runtests.py '
2036+
'file_storage.tests.FileStoragePermissionsTests"}'
2037+
),
2038+
},
2039+
},
2040+
],
2041+
},
2042+
{
2043+
"role": "tool",
2044+
"tool_call_id": "call-test",
2045+
"content": (
2046+
"<returncode>1</returncode>\n<output>"
2047+
"FileStoragePermissionsTests (unittest.loader._FailedTest.FileStoragePermissionsTests) ... ERROR\n"
2048+
"AttributeError: module 'file_storage.tests' has no attribute 'FileStoragePermissionsTests'\n"
2049+
"FAILED (errors=1)</output>"
2050+
),
2051+
},
2052+
],
2053+
"tools": [{"type": "function", "function": {"name": "bash"}}],
2054+
}
2055+
2056+
step_type, tool_names = _classify_step(body)
2057+
features = _extract_routing_features(
2058+
body,
2059+
step_type=step_type,
2060+
tool_names=tool_names,
2061+
prompt="Run the target test.",
2062+
session_id="session-1",
2063+
)
2064+
2065+
assert features.step_type == "tool-result-followup"
2066+
assert features.step_risk == "high"
2067+
assert features.tier_floor is Tier.MEDIUM
2068+
assert features.tier_cap is Tier.MEDIUM
2069+
assert features.tier_cap_reason == "invocation-recovery"
2070+
assert features.verification_failed is False
2071+
assert features.failure_kind == "invocation"
2072+
2073+
2074+
def test_read_only_source_output_with_failure_words_is_not_tool_failure() -> None:
2075+
from uncommon_route.proxy import _classify_step, _extract_routing_features
2076+
2077+
body = {
2078+
"messages": [
2079+
{"role": "user", "content": "Inspect this source file."},
2080+
{
2081+
"role": "assistant",
2082+
"content": None,
2083+
"tool_calls": [
2084+
{
2085+
"id": "call-sed",
2086+
"type": "function",
2087+
"function": {
2088+
"name": "bash",
2089+
"arguments": '{"command": "sed -n \\"1,80p\\" /testbed/tests/test_utils/tests.py"}',
2090+
},
2091+
},
2092+
],
2093+
},
2094+
{
2095+
"role": "tool",
2096+
"tool_call_id": "call-sed",
2097+
"content": (
2098+
"<returncode>0</returncode>\n<output>"
2099+
"with self.assertRaisesMessage(AssertionError, msg):\n"
2100+
" self.assertURLEqual(left, right)\n"
2101+
"# The test should fail if the helper regresses.\n"
2102+
"</output>"
2103+
),
2104+
},
2105+
],
2106+
"tools": [{"type": "function", "function": {"name": "bash"}}],
2107+
}
2108+
2109+
step_type, tool_names = _classify_step(body)
2110+
features = _extract_routing_features(
2111+
body,
2112+
step_type=step_type,
2113+
tool_names=tool_names,
2114+
prompt="Inspect this source file.",
2115+
session_id="session-1",
2116+
)
2117+
2118+
assert features.step_type == "tool-result-followup"
2119+
assert features.step_risk in {"low", "normal"}
2120+
assert features.tier_floor is None
2121+
assert features.verification_failed is False
2122+
assert features.failure_kind == ""
19822123

19832124

19842125
def test_environment_recovery_cap_is_not_softened_by_agent_pressure(monkeypatch) -> None:

0 commit comments

Comments
 (0)