The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(telemetry): rows saved with the retired setup names still package
alt-glitchdf6895a85331
diff --git a/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json b/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.jsonindex ee56de23537..a093aa7dd98 100644--- a/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json+++ b/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json@@ -3656,7 +3656,9 @@"safe","search","session_search",+ "setup","skills",+ "start_chat","terminal","todo","tts",diff --git a/hermes_cli/observability/shared_metrics_contract.py b/hermes_cli/observability/shared_metrics_contract.pyindex af270d79bfd..e82b4e13303 100644--- a/hermes_cli/observability/shared_metrics_contract.py+++ b/hermes_cli/observability/shared_metrics_contract.py@@ -156,7 +156,12 @@ TASK_FAILURE_CLASSES = MODEL_ERROR_CLASSES | frozenset({_CORE_GATEWAY_PLATFORMS = (frozenset(PLATFORMS) - {"api_server", "cli", "cron"}) | {"none", "plugin", "relay"}# The Tool Search bridge tools are not in a toolset; every hosted connector tool reads ``connector``.BRIDGE_TOOL_NAMES = frozenset({"tool_call", "tool_describe", "tool_search"})-TOOL_NAMES = BUILTIN_TOOL_NAMES | BRIDGE_TOOL_NAMES | {"connector", "mcp", "plugin", "unknown"}+# Deleted with the old setup flow. v4 only adds values, and rows that v0.21.6/7 saved with these names+# must still package; recording maps through the live sets (tool_metric_name, toolset_metric_name).+RETIRED_TOOL_NAMES = frozenset({"setup_choose", "start_chat"})+RETIRED_TOOLSET_NAMES = frozenset({"setup", "start_chat"})+_LIVE_TOOL_NAMES = BUILTIN_TOOL_NAMES | BRIDGE_TOOL_NAMES | {"connector", "mcp", "plugin", "unknown"}+TOOL_NAMES = _LIVE_TOOL_NAMES | RETIRED_TOOL_NAMESTOOL_ERROR_CLASSES = frozenset({"alias", "blocked", "connection_required", "connector_backend", "contract_violation", "exception","interrupted", "invalid_arguments", "none", "not_allowed", "timeout", "tool_error", "unknown",@@ -629,7 +634,7 @@ TOOL_SCHEMA_TOKEN_BUCKETS = frozenset({"0", "lt_2k", "2k_to_5k", "5k_to_10k", "10k_to_20k", "20k_to_40k", "gte_40k",})# Toolsets Hermes ships; MCP servers and plugin toolsets collapse to custom.-TOOLSET_NAMES = BUILTIN_TOOLSET_NAMES | {"custom"}+TOOLSET_NAMES = BUILTIN_TOOLSET_NAMES | RETIRED_TOOLSET_NAMES | {"custom"}# compression is the expected cause; the rest are Hermes invalidating a warm prefix (bugs or# user-driven), or the provider reporting a cold read Hermes did not cause.CACHE_BREAK_CAUSES = frozenset({@@ -1020,7 +1025,7 @@ _COUNTER_DIMENSION_VALUES: dict[str, dict[str, frozenset[str]]] = {},# ---- end v5 desktop ----# ---- v5 signals ----- TOOL_UNAVAILABLE_METRIC: {"tool_name": BUILTIN_TOOL_NAMES},+ TOOL_UNAVAILABLE_METRIC: {"tool_name": BUILTIN_TOOL_NAMES | RETIRED_TOOL_NAMES},PROVIDER_SETUP_METRIC: {"event": PROVIDER_SETUP_EVENTS, "failure_class": PROVIDER_SETUP_FAILURE_CLASSES,"surface": PROVIDER_SETUP_SURFACES,@@ -1773,7 +1778,7 @@ def tool_terminal_fields("outcome": outcome,"retry_count_bucket": tool_retry_bucket(kwargs.get("retry_count")),"tool_category": category if category in TOOL_CATEGORIES else tool_category(kwargs),- "tool_name": tool_name if tool_name is not None and tool_name in TOOL_NAMES+ "tool_name": tool_name if tool_name is not None and tool_name in _LIVE_TOOL_NAMESelse tool_metric_name(kwargs),}diff --git a/tests/hermes_cli/test_relay_shared_metrics.py b/tests/hermes_cli/test_relay_shared_metrics.pyindex b795f4e4ae0..a4eaa4852c1 100644--- a/tests/hermes_cli/test_relay_shared_metrics.py+++ b/tests/hermes_cli/test_relay_shared_metrics.py@@ -1258,6 +1258,29 @@ def test_package_builder_rejects_tampered_dimensions(tmp_path):assert list(outbox_directory.glob("*.json")) == [][email protected](("metric_name", "dimensions"), [+ ("hermes.tool_enabled_unused.count", {"toolset": "start_chat", "used": "yes"}),+ ("hermes.tool.usage.count", {"error_class": "none", "outcome": "success", "tool_name": "setup_choose"}),+])+def test_a_saved_row_naming_a_retired_setup_tool_or_toolset_still_packages(tmp_path, metric_name, dimensions):+ # v0.21.6/7 recorded these names before the old setup flow was deleted; v4 only adds values.+ database_path = tmp_path / "metrics.sqlite3"+ store = SharedMetricsStore(database_path, tmp_path / "outbox")+ store.record_model_call(_dimensions(), _resource())+ with sqlite3.connect(database_path) as connection:+ connection.execute(+ "UPDATE counter_aggregates SET metric_name = ?, dimensions_json = ?",+ (metric_name, json.dumps(dimensions, sort_keys=True, separators=(",", ":"))),+ )++ [path] = store.create_and_export_package()++ package = json.loads(path.read_text(encoding="utf-8"))+ [metric] = package["metrics"]+ assert (metric["name"], metric["dimensions"]) == (metric_name, dimensions)+ _schema_validator().validate(package)++def test_package_builder_rejects_tampered_client_resources(tmp_path):database_path = tmp_path / "metrics.sqlite3"outbox_directory = tmp_path / "outbox"