Skip to content

The agent that grows with you

fix(telemetry): tool_unavailable skips tool_search-deferred built-ins and cron (M14, m20)

teknium13a0eaff6b2a5
diff --git a/hermes_cli/observability/shared_metrics_signals.py b/hermes_cli/observability/shared_metrics_signals.py
index bc95582b7b1..bc6a8b3f0d7 100644
--- a/hermes_cli/observability/shared_metrics_signals.py
+++ b/hermes_cli/observability/shared_metrics_signals.py
@@ -32,16 +32,18 @@ _DAYS_SINCE_INSTALL_THRESHOLDS = (
def tool_unavailable_fields(agent: Any, name: Any, issue: str, route: dict[str, str]) -> dict[str, str] | None:
"""Fields for a call to a shipped built-in the session has disabled; None for anything else.
- Background reviews and delegated children run with toolsets Hermes (or the parent model)
- narrowed on purpose, so their misses say nothing about what users should get by default.
+ Background reviews, delegated children and cron jobs run with toolsets Hermes (or the parent
+ model) narrowed on purpose, so their misses say nothing about what users should get by default.
+ A built-in deferred behind ``tool_search`` is enabled (reachable through ``tool_call``), not missing.
"""
if issue != "unknown_tool" or not isinstance(name, str) or name not in contract.BUILTIN_TOOL_NAMES:
return None
- if getattr(agent, "_delegate_depth", 0):
+ if getattr(agent, "_delegate_depth", 0) or getattr(agent, "platform", None) == "cron":
return None
+ from agent.tool_executor import _tool_search_scoped_names
from tools.skill_provenance import is_background_review
- if is_background_review():
+ if is_background_review() or name in _tool_search_scoped_names(agent):
return None
return {**route, "tool_name": name}
diff --git a/tests/hermes_cli/test_shared_metrics_signals.py b/tests/hermes_cli/test_shared_metrics_signals.py
index 2287b510d09..e564d6025ee 100644
--- a/tests/hermes_cli/test_shared_metrics_signals.py
+++ b/tests/hermes_cli/test_shared_metrics_signals.py
@@ -63,6 +63,20 @@ def test_only_a_disabled_shipped_builtin_is_reported(monkeypatch):
assert signals.tool_unavailable_fields(agent, "memory", "unknown_tool", route) is None
+def test_deferred_builtins_and_cron_narrowing_are_not_unavailable(monkeypatch):
+ monkeypatch.setattr("tools.skill_provenance.is_background_review", lambda: False)
+ route = {"model": "m", "provider": "openrouter"}
+ agent = SimpleNamespace(_delegate_depth=0, enabled_toolsets=None, disabled_toolsets=None)
+ # Enabled but behind tool_search (reachable via tool_call): not "disabled in this session".
+ assert signals.tool_unavailable_fields(agent, "session_search", "unknown_tool", route) is None
+ # The same tool in a session that turned its toolset off is.
+ narrowed = SimpleNamespace(_delegate_depth=0, enabled_toolsets=None, disabled_toolsets=["session_search"])
+ assert signals.tool_unavailable_fields(narrowed, "session_search", "unknown_tool", route) is not None
+ # Cron strips clarify on purpose.
+ cron = SimpleNamespace(_delegate_depth=0, platform="cron")
+ assert signals.tool_unavailable_fields(cron, "clarify", "unknown_tool", route) is None
+
+
def test_turn_validation_reports_disabled_builtin_once_and_unknown_names_never(marks, monkeypatch):
from hermes_cli.observability.shared_metrics_model import record_tool_call_quality
diff --git a/website/docs/developer-guide/relay-shared-metrics.md b/website/docs/developer-guide/relay-shared-metrics.md
index 4a0497b4ac0..53263e9cd5c 100644
--- a/website/docs/developer-guide/relay-shared-metrics.md
+++ b/website/docs/developer-guide/relay-shared-metrics.md
@@ -442,7 +442,7 @@ database and the count is not reported.
| Metric | Dimensions | Question it answers |
|---|---|---|
-| `hermes.tool_unavailable.count` | provider, model, tool name (shipped built-ins only) | Which toolsets should be on by default: the model called a tool Hermes ships that this session did not enable. Any other unknown name (plugin, MCP, hallucinated) stays a `model_tool_quality` `unknown_tool` issue only. Background reviews and delegated children, whose toolsets are narrowed on purpose, are excluded. |
+| `hermes.tool_unavailable.count` | provider, model, tool name (shipped built-ins only) | Which toolsets should be on by default: the model called a tool Hermes ships that this session did not enable. Any other unknown name (plugin, MCP, hallucinated) stays a `model_tool_quality` `unknown_tool` issue only. A built-in the session enabled but deferred behind `tool_search` (reachable through `tool_call`) is not unavailable. Background reviews, delegated children and cron jobs, whose toolsets are narrowed on purpose, are excluded. |
| `hermes.provider_setup.count` | provider (catalog name; custom endpoints read `custom`), surface (`cli_setup`, `cli_model`, `tui`, `desktop`, `dashboard`), event (`started`, `completed`, `failed`, `abandoned`), failure class (`auth`, `network`, `no_models`, `cancelled`, `other`; `none` unless failed) | Where connecting a provider breaks down. `started` counts once a provider is picked; the flow's end is recorded by the surface that ran it. In the CLI pickers Esc ends the flow `failed`/`cancelled`; Back (Left arrow) keeps it open, so picking the same provider again continues it (one `started`), while picking another provider or leaving the command ends it `cancelled`. A flow nobody finished leaves a local marker that the next setup start or Hermes start in the profile reports as `abandoned` (its process is gone, or it has been pending over an hour); an OAuth device code left to expire is also `abandoned`. A new or changed provider API key saved from a form (TUI/Desktop/dashboard) and a newly added custom endpoint start and complete in one action; clearing a key, re-saving the same key, editing an existing endpoint, ecosystem tokens (`GITHUB_TOKEN`, `GH_TOKEN`, `HF_TOKEN`) and keys a tool's settings panel also asks for (e.g. `GEMINI_API_KEY`, `XAI_API_KEY`, `DEEPINFRA_API_KEY`) are not counted from the generic key form. Never a key, token, base URL or error text. Leaving the provider picker before choosing one is not counted. |
| `hermes.feature_adoption.count` | feature (`memory`, `skills_created`, `delegation`, `cron`, `gateway_platform`, `desktop`, `tui`, `mcp`, `plugins`, `browser`, `voice`, `kanban`, `projects`, `bot_mode`, `curator`), days since install (`same_day`, `1d_to_7d`, `7d_to_30d`, `30d_to_90d`, `gte_90d`, `unknown`) | How long after install each major feature is first really used. Once per feature per install, latched in the local database, derived from the counters above (a foreground memory write, a created skill, a successful MCP/plugin/browser/TTS/kanban tool call, a Desktop/TUI/gateway task, a cron run, a curator run) plus direct first-use reports for Bot Mode messages and project creation. The age is the owning profile's (its first session). |
| `hermes.feature_disabled.count` | kind (`toolset`, `skill`, `plugin`, `platform`, `setting`, `memory`, `curator`, `compression`), name, surface (`cli_tools`, `cli_config`, `cli_slash`, `tui`, `desktop`, `dashboard`), event (`disabled`, `re_enabled`) | What users turn off. Diffed at the config write itself: a default-on toolset removed, a skill or plugin added to its disabled list, a default-`true` setting set false (and each moved back). Names are public only when shipped — toolset key, bundled/catalog skill, bundled/catalog plugin (messaging-platform plugins report as `platform`), `DEFAULT_CONFIG` key path (never a value) — else `custom`. Uninstalling a catalog skill counts as `disabled`. Only user entry points record (`hermes tools` / `config` / `skills` / `plugins`, chat slash commands, TUI/Desktop, dashboard); setup and migrations do not. At most once per (kind, name, event) per day. |