The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(telemetry): saved rows naming the retired setup tools still package
alt-glitchb18d304d54e5
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..0baad51e551 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",@@ -4658,10 +4660,12 @@"read_window_below","search_files","session_search",+ "setup_choose","show_tip","skill_manage","skill_view","skills_list",+ "start_chat","terminal","text_to_speech","todo_list",diff --git a/hermes_cli/observability/shared_metrics_contract.py b/hermes_cli/observability/shared_metrics_contract.pyindex af270d79bfd..7309aaea2e0 100644--- a/hermes_cli/observability/shared_metrics_contract.py+++ b/hermes_cli/observability/shared_metrics_contract.py@@ -14,7 +14,7 @@ from agent.relay_runtime import ()from hermes_cli.platforms import PLATFORMSfrom tools.connectors.gateway.names import CONNECTOR_NAME_PREFIX-from toolsets import BUILTIN_TOOL_NAMES, BUILTIN_TOOLSET_NAMES+from toolsets import BUILTIN_TOOL_NAMES, BUILTIN_TOOLSET_NAMES, RETIRED_TOOL_NAMES, RETIRED_TOOLSET_NAMESSCHEMA_KEY = "hermes.metrics.schema_version"# A random per-emit token (no payload) on rows whose producer waits to learn they were SAVED: facts@@ -156,7 +156,11 @@ 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"}+# Names a saved row may carry: today's tools plus retired ones, so rows recorded before an upgrade+# still package. Recording maps through the live set (tool_metric_name).+ACCEPTED_TOOL_NAMES = BUILTIN_TOOL_NAMES | RETIRED_TOOL_NAMES+_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 +633,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 +1024,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": ACCEPTED_TOOL_NAMES},PROVIDER_SETUP_METRIC: {"event": PROVIDER_SETUP_EVENTS, "failure_class": PROVIDER_SETUP_FAILURE_CLASSES,"surface": PROVIDER_SETUP_SURFACES,@@ -1773,7 +1777,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..899826bf319 100644--- a/tests/hermes_cli/test_relay_shared_metrics.py+++ b/tests/hermes_cli/test_relay_shared_metrics.py@@ -1258,6 +1258,36 @@ def test_package_builder_rejects_tampered_dimensions(tmp_path):assert list(outbox_directory.glob("*.json")) == []+_RETIRED_SETUP_ROWS = [+ ("hermes.tool_unavailable.count", {"model": "unknown", "provider": "unknown", "tool_name": "setup_choose"}),+ ("hermes.tool_unavailable.count", {"model": "unknown", "provider": "unknown", "tool_name": "start_chat"}),+ ("hermes.tool.usage.count", {"error_class": "none", "outcome": "success", "tool_name": "setup_choose"}),+ ("hermes.tool_enabled_unused.count", {"toolset": "setup", "used": "no"}),+ ("hermes.tool_enabled_unused.count", {"toolset": "start_chat", "used": "yes"}),+]++[email protected](("metric_name", "dimensions"), _RETIRED_SETUP_ROWS)+def test_a_pending_row_naming_a_retired_setup_tool_still_packages(tmp_path, metric_name, dimensions):+ # Saved before the setup tools were deleted; the upgraded reader must still ship it.+ database_path = tmp_path / "metrics.sqlite3"+ outbox_directory = tmp_path / "outbox"+ store = SharedMetricsStore(database_path, outbox_directory)+ 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"diff --git a/toolsets.py b/toolsets.pyindex b9eb685c05c..ac6d334b6d6 100644--- a/toolsets.py+++ b/toolsets.py@@ -250,6 +250,10 @@ TOOLSET_SESSION_PLATFORMS = {name: spec["platforms"] for name, spec in TOOLSETS.# these names, so a plugin, MCP server or custom toolset name never leaves the machine.BUILTIN_TOOL_NAMES = frozenset(tool for spec in TOOLSETS.values() for tool in spec["tools"])BUILTIN_TOOLSET_NAMES = frozenset(TOOLSETS)+# What the desktop's agentic onboarding shipped and then lost. Metrics rows saved before the upgrade+# still name them, so the metrics vocabulary keeps accepting them; the live registry does not.+RETIRED_TOOL_NAMES = frozenset({"setup_choose", "start_chat"})+RETIRED_TOOLSET_NAMES = frozenset({"setup", "start_chat"})def _registry():@@ -471,13 +475,9 @@ def agent_tool_drops(agent: Any) -> frozenset:return side_agent_tool_drops(agent) | session_platform_tool_drops(getattr(agent, "platform", None))-# Toolsets the desktop's agentic onboarding added and then lost; old configs still list them. Accepted-# so they drop quietly (they resolve to no tools) instead of warning on every launch.-_RETIRED_TOOLSETS = frozenset({"setup", "start_chat"})--def validate_toolset(name: str) -> bool:- return (name in {"all", "*"} or name in TOOLSETS or name in _RETIRED_TOOLSETS+ # Old configs still list the retired toolsets; they resolve to no tools, so accept them quietly.+ return (name in {"all", "*"} or name in TOOLSETS or name in RETIRED_TOOLSET_NAMESor name in _get_plugin_toolset_names() or name in _get_registry_toolset_aliases())