Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(model-hub): list timeout_error once in the taxonomy and its mirrors (#2472)

Call Whitebd60218381de
diff --git a/core/handlers/model_hub/classification.py b/core/handlers/model_hub/classification.py
index dcd955e0a..ce3176b35 100644
--- a/core/handlers/model_hub/classification.py
+++ b/core/handlers/model_hub/classification.py
@@ -129,7 +129,8 @@ _MACHINE_ERROR_TAXONOMY: Final[Mapping[str, _MachineErrorRule]] = {
"overloaded": _MachineErrorRule("transient", True, 80, "fallback", "server_error", None, 30, None),
"overloaded_error": _MachineErrorRule("transient", True, 80, "fallback", "server_error", None, 30, None),
"server_error": _MachineErrorRule("server", True, 70, "fallback", "server_error", None, 30, None),
- # CLIProxyAPI's Claude type for an upstream 504, and since v8 for a 408.
+ # CLIProxyAPI's Claude-shaped type for an upstream 504, and since v8 for a 408;
+ # its OpenAI shape is type server_error with code request_timeout.
"timeout_error": _MachineErrorRule("server", True, 70, "fallback", "server_error", None, 30, None),
"internal_error": _MachineErrorRule("server", True, 70, "fallback", "server_error", None, 30, None),
"api_error": _MachineErrorRule("server", True, 10, "fallback", "server_error", None, 30, None),
@@ -137,9 +138,6 @@ _MACHINE_ERROR_TAXONOMY: Final[Mapping[str, _MachineErrorRule]] = {
"server", True, 70, "fallback", "server_error", None, 30, None
),
"upstream_error": _MachineErrorRule("server", True, 70, "fallback", "server_error", None, 30, None),
- # CLIProxyAPI's Claude-shaped error type for an upstream 408 or 504; its OpenAI
- # shape is type server_error with code request_timeout.
- "timeout_error": _MachineErrorRule("server", True, 70, "fallback", "server_error", None, 30, None),
}
MACHINE_ERROR_CODES: Final = frozenset(_MACHINE_ERROR_TAXONOMY)
UPSTREAM_MACHINE_ERROR_CODES: Final = frozenset(
diff --git a/docs/plans/model-hub-contracts/turn-provenance.schema.json b/docs/plans/model-hub-contracts/turn-provenance.schema.json
index d73695e06..edeade036 100644
--- a/docs/plans/model-hub-contracts/turn-provenance.schema.json
+++ b/docs/plans/model-hub-contracts/turn-provenance.schema.json
@@ -214,7 +214,6 @@
"api_error",
"service_unavailable_error",
"upstream_error",
- "timeout_error",
null
],
"description": "Optional observed machine code from classification.UPSTREAM_MACHINE_ERROR_CODES. If model_not_found was observed and classification returned upstream_request_invalid, retain that specific code over a co-occurring generic invalid_request_error type; otherwise use existing specificity order. This diagnostic selection never reranks or changes classification. Never derive a code from invalid_parameter; unknown codes, bodies, headers and credentials are not retained. Absent evidence is null; historical records may omit the field."
diff --git a/pyproject.toml b/pyproject.toml
index 029d8399f..538911065 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -155,7 +155,7 @@ line-length = 120
src = ["."]
[tool.ruff.lint]
-select = ["E9", "F63", "F7", "F82"]
+select = ["E9", "F63", "F7", "F82", "F601"]
extend-ignore = ["E501"]
[tool.pytest.ini_options]
diff --git a/tests/test_model_hub_provenance.py b/tests/test_model_hub_provenance.py
index 22d7bce63..481ff5540 100644
--- a/tests/test_model_hub_provenance.py
+++ b/tests/test_model_hub_provenance.py
@@ -312,6 +312,8 @@ def test_terminal_diagnostic_schema_uses_the_production_machine_code_authority()
(Path(__file__).parents[1] / "docs/plans/model-hub-contracts/turn-provenance.schema.json").read_text()
)
enum = schema["properties"]["terminal_error"]["properties"]["upstream_error_code"]["enum"]
+ # Each code is listed once; the set comparison below would collapse a duplicate.
+ assert len(enum) == len(set(enum))
assert set(enum) - {None} == UPSTREAM_MACHINE_ERROR_CODES
assert "engine_down" not in enum
diff --git a/tests/test_model_hub_structure_guards.py b/tests/test_model_hub_structure_guards.py
index 4e6f7182d..ef52db41b 100644
--- a/tests/test_model_hub_structure_guards.py
+++ b/tests/test_model_hub_structure_guards.py
@@ -301,7 +301,6 @@ MACHINE_ERROR_FAMILY_FIXTURES = {
"api_error",
"service_unavailable_error",
"upstream_error",
- "timeout_error",
),
"transient": (
"rate_limit_error",
@@ -1322,7 +1321,10 @@ def test_settlement_abandonment_cannot_overwrite_a_committed_terminal_fact() ->
def test_machine_error_family_product_is_complete_across_transports() -> None:
- expected_codes = {code for codes in MACHINE_ERROR_FAMILY_FIXTURES.values() for code in codes}
+ fixture_codes = [code for codes in MACHINE_ERROR_FAMILY_FIXTURES.values() for code in codes]
+ expected_codes = set(fixture_codes)
+ # Each code is listed once; the set comparison below would collapse a duplicate.
+ assert len(fixture_codes) == len(expected_codes)
assert expected_codes == set(UPSTREAM_MACHINE_ERROR_CODES)
assert set(MACHINE_ERROR_CODES) - expected_codes == {"engine_down"}
observed: set[tuple[str, str, str]] = set()