Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(missions): classify worker terminal errors into the error-class vocabulary
Ruben Lütke023a0a2edc07
diff --git a/jarvis/missions/kontrollierer/orchestrator.py b/jarvis/missions/kontrollierer/orchestrator.pyindex 5ed6b59ab1..36fada7fdb 100644--- a/jarvis/missions/kontrollierer/orchestrator.py+++ b/jarvis/missions/kontrollierer/orchestrator.py@@ -209,6 +209,42 @@ def _worker_error_is_auth(err: str) -> bool:))++def _classify_worker_error(err: str, *, timed_out: bool = False) -> str | None:+ """Map a worker's terminal error onto MISSION_ERROR_CLASSES, or ``None``.++ Pure + offline; the single place the orchestrator derives the+ provider-failure class that flows to WorkerKilled/MissionFailed and from+ there to the Sub-Agents view and the voice announcer. Order matters:+ the structured timeout flag wins (it is the robust signal), then auth+ (the most specific text class), then quota/billing, then the generic+ transient bucket. Unclassifiable errors return ``None`` so consumers+ fall back to the mission-level ``reason``.+ """+ if timed_out:+ return "worker_timeout"+ if not err:+ return None+ low = err.lower()+ if _worker_error_is_auth(low):+ return "provider_auth"+ if any(+ m in low+ for m in (+ "balance", "billing", "credit",+ "session limit", "usage limit",+ "rate limit", "rate_limit", "ratelimit",+ "too many requests", "429",+ "out of credits", "out_of_credits",+ )+ ):+ return "provider_quota"+ if "timeout" in low:+ return "worker_timeout"+ if _worker_error_is_transient(low):+ return "provider_unreachable"+ return None+# Mission-level wall-clock safety net. Bounds TOTAL execution time across all# critic iterations + the critic subprocess + decomposition — the per-iteration# worker cap does not. Measured AFTER the concurrency semaphore is acquireddiff --git a/tests/missions/kontrollierer/test_error_classification.py b/tests/missions/kontrollierer/test_error_classification.pynew file mode 100644index 0000000000..bfedb8dada--- /dev/null+++ b/tests/missions/kontrollierer/test_error_classification.py@@ -0,0 +1,55 @@+"""Unit matrix for the worker-error -> error_class mapping (pure function).++Real-world inputs from live incidents: the 2026-07-06 expired Claude OAuth+401, the 2026-06-08 codex refresh-token death, the 2026-06-10 Claude Max+session-limit, the 2026-05-28 zero-output startup timeout.+"""+from __future__ import annotations++import pytest++from jarvis.missions.events import MISSION_ERROR_CLASSES+from jarvis.missions.kontrollierer.orchestrator import _classify_worker_error+++ "err,expected",+ [+ # 2026-07-06 live text (expired Claude Max OAuth token)+ (+ "Failed to authenticate. API Error: 401 Invalid authentication credentials",+ "provider_auth",+ ),+ ("Failed to refresh token. Please log in again.", "provider_auth"),+ ("Not logged in · Please run /login", "provider_auth"),+ ("You've hit your usage limit. Try again at 7:40 PM.", "provider_quota"),+ ("You've hit your session limit · resets 11:10pm", "provider_quota"),+ ("Credit balance is too low", "provider_quota"),+ ("429 Too Many Requests", "provider_quota"),+ ("503 Service Unavailable", "provider_unreachable"),+ ("upstream is overloaded, please try again", "provider_unreachable"),+ (+ "subprocess produced no output within 120s startup timeout",+ "worker_timeout",+ ),+ ("Compilation failed: missing semicolon", None),+ ("", None),+ ],+)+def test_classification_matrix(err: str, expected: str | None) -> None:+ assert _classify_worker_error(err) == expected+++def test_structured_timeout_flag_wins() -> None:+ assert _classify_worker_error("", timed_out=True) == "worker_timeout"+ # Even a classifiable text defers to the structured flag.+ assert _classify_worker_error("401", timed_out=True) == "worker_timeout"+++def test_all_returned_tokens_are_in_the_closed_set() -> None:+ samples = [+ "401 Unauthorized", "usage limit", "503", "overloaded", "timeout",+ ]+ for s in samples:+ token = _classify_worker_error(s)+ assert token is None or token in MISSION_ERROR_CLASSES