The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(telemetry): terminal.outcome=timeout comes only from Hermes' deadline
teknium16cc2f4ab9258
diff --git a/tests/hermes_cli/test_shared_metrics_harness.py b/tests/hermes_cli/test_shared_metrics_harness.pyindex 7a87dfd0c64..f51dd5a4106 100644--- a/tests/hermes_cli/test_shared_metrics_harness.py+++ b/tests/hermes_cli/test_shared_metrics_harness.py@@ -125,6 +125,19 @@ def test_foreground_terminal_commands_count_by_kind_and_outcome(direct_runtime,assert "definitely" not in json.dumps(_stored_values(tmp_path, contract.TERMINAL_OUTCOME_METRIC))+def test_backend_exception_mentioning_timeout_is_not_a_terminal_timeout(direct_runtime, tmp_path, monkeypatch):+ from tools.environments.base import BaseEnvironment+ from tools.terminal_tool import terminal_tool++ def connect_timeout(self, *a, **k):+ raise RuntimeError("ssh: connect to host example port 22: Connection timeout")++ monkeypatch.setenv("TERMINAL_ENV", "local")+ monkeypatch.setattr(BaseEnvironment, "execute", connect_timeout)+ assert json.loads(terminal_tool("echo hi", task_id="harness-exc"))["exit_code"] == 124 # user-facing result unchanged+ assert not _stored_values(tmp_path, contract.TERMINAL_OUTCOME_METRIC)++# ---- loop guards -------------------------------------------------------------------------------def test_loop_guards_count_once_per_turn_per_signal_and_detector(direct_runtime, tmp_path):diff --git a/tools/terminal_tool.py b/tools/terminal_tool.pyindex ba3db664868..474b64e8926 100644--- a/tools/terminal_tool.py+++ b/tools/terminal_tool.py@@ -1273,9 +1273,9 @@ def _run_foreground()breakexcept Exception as e:+ # A backend exception (e.g. an SSH connect timeout) never reached an exit status, so it+ # is not a terminal outcome; Hermes' own deadline arrives as ``hermes_timed_out``.if "timeout" in str(e).lower():- if metered:- record_terminal_outcome(command, env_type, outcome="timeout")return _error_json(f"Command timed out after {effective_timeout} seconds", exit_code=124)# Retry on transient errorsif retry_count < max_retries: