The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cron): an unreadable cron toolset restriction fails the run instead of granting every tool
teknium19013fcdc87cf
diff --git a/cron/scheduler.py b/cron/scheduler.pyindex 37ba122be31..479d7b5609d 100644--- a/cron/scheduler.py+++ b/cron/scheduler.py@@ -383,17 +383,19 @@ def _merge_mcp_into_per_job_toolsets(per_job: list[str], cfg: dict) -> list[str]return result-def _resolve_cron_enabled_toolsets(job: dict, cfg: dict) -> list[str] | None:+def _resolve_cron_enabled_toolsets(job: dict, cfg: dict) -> list[str]:"""Toolset list for a cron job. Precedence: per-job ``enabled_toolsets`` (+ MCP merge) >``cron`` platform config (``_get_platform_tools``, which strips _DEFAULT_OFF_TOOLSETS so fresh- installs run without ``moa``) > ``None`` on any failure (full default set).+ installs run without ``moa``). A lookup failure fails CLOSED: the run errors out.1. Per-job ``enabled_toolsets`` (set via ``cronjob`` tool on create/update). Keeps the agent'sjob-scoped toolset override intact — #6130. Enabled MCP servers are layered on per``_merge_mcp_into_per_job_toolsets`` so a native-toolset allowlist does not silently strip MCP tools. 2.Mirrors gateway behavior (``_get_platform_tools(cfg, platform_key)``) so users can gate cron toolsets- globally without recreating every job. 3. ``None`` on any lookup failure — AIAgent loads the full- default set (legacy behavior before this change, preserved as the safety net).+ globally without recreating every job. 3. Never ``None``: AIAgent reads ``None`` as "every+ toolset", so an unreadable ``platform_toolsets.cron`` restriction would hand an unattended job+ the full default set (#111380). The raise reaches ``run_job``'s failure path, which records the+ error on the job and opens an incident, so the operator sees it instead of a widened run."""per_job = job.get("enabled_toolsets")if per_job:@@ -402,10 +404,10 @@ def _resolve_cron_enabled_toolsets(job: dict, cfg: dict) -> list[str] | None:from hermes_cli.tools_config import _get_platform_tools # lazy: avoid heavy import at cron module loadreturn sorted(_get_platform_tools(cfg or {}, "cron"))except Exception as exc:- logger.warning(- "Cron toolset resolution failed, falling back to full default toolset: %s",- exc)- return None+ raise RuntimeError(+ "Cron toolset resolution failed, so this run was refused rather than given every "+ f"tool. Check `platform_toolsets.cron` in config.yaml (`hermes cron doctor`): {exc}"+ ) from excdef _resolve_job_reasoning_config(job: dict, cfg: dict, model: str) -> dict | None:diff --git a/tests/cron/test_scheduler.py b/tests/cron/test_scheduler.pyindex b89c027a647..3eb0bf83736 100644--- a/tests/cron/test_scheduler.py+++ b/tests/cron/test_scheduler.py@@ -151,6 +151,18 @@ class TestPerJobToolsetMcpMerge:result = _resolve_cron_enabled_toolsets(job, {})assert result == ["file", "memory", "web"]+ def test_resolver_failure_fails_closed_instead_of_every_toolset(self):+ """An unreadable cron-platform restriction must not become ``None`` (= all toolsets,+ #111380): the resolver raises and run_job records the failure. A malformed+ ``platform_toolsets`` block is the real-world trigger, so no patching of the resolver."""+ job = {"enabled_toolsets": None}+ with pytest.raises(RuntimeError, match="toolset resolution failed"):+ _resolve_cron_enabled_toolsets(job, {"platform_toolsets": "oops"})+ # Per-job lists never touch the platform resolver: an unknown name still resolves.+ assert _resolve_cron_enabled_toolsets(+ {"enabled_toolsets": ["nonexistent_ts"]}, {"platform_toolsets": "oops", "mcp_servers": {}}+ ) == ["nonexistent_ts"]+class TestResolveOrigin:def test_full_origin(self):diff --git a/website/docs/user-guide/features/cron.md b/website/docs/user-guide/features/cron.mdindex 708ee8fb6cb..5b9ae17fd73 100644--- a/website/docs/user-guide/features/cron.md+++ b/website/docs/user-guide/features/cron.md@@ -1112,7 +1112,7 @@ cronjob(action="create", name="weekly-news-summary",prompt="Summarize this week's AI news: ...")```-When `enabled_toolsets` is set on a job it wins; otherwise the `hermes tools` cron-platform config wins; otherwise Hermes falls back to the built-in defaults. This matters for cost control: carrying `browser`, `delegation` into every tiny "fetch news" job bloats the tool-schema prompt on every LLM call.+When `enabled_toolsets` is set on a job it wins; otherwise the `hermes tools` cron-platform config wins; otherwise Hermes falls back to the built-in defaults. If the cron-platform toolset config cannot be read at all (for example a malformed `platform_toolsets` block in `config.yaml`), the run fails with a recorded error instead of quietly running with every tool — check `hermes cron list` / `hermes cron doctor`. This matters for cost control: carrying `browser`, `delegation` into every tiny "fetch news" job bloats the tool-schema prompt on every LLM call.### Skipping the agent entirely: `wakeAgent`