The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(cron): keep reasoning_effort off the model-facing cronjob tool schema
Teknium991af03f4cc9
diff --git a/tests/cron/test_cron_reasoning_effort.py b/tests/cron/test_cron_reasoning_effort.pyindex c0f7d361d8e..d9f257439c9 100644--- a/tests/cron/test_cron_reasoning_effort.py+++ b/tests/cron/test_cron_reasoning_effort.py@@ -168,57 +168,19 @@ class TestSchedulerJobReasoningPrecedence:class TestCronjobToolReasoningEffort:- """The model tool covers BOTH mutation verbs (create AND update) and- surfaces the field in job listings — the mutation-verb symmetry rule."""+ """The model tool READS the field (list surfacing) but must never WRITE+ it: models don't make model-configuration decisions (standing policy —+ the only exception is user-defined profile selection). The pin is set+ via `hermes cron create/edit --reasoning-effort` only."""- def test_create_via_tool_persists_pin(self, tmp_cron_dir, monkeypatch):+ def test_format_job_surfaces_pin_when_set(self, tmp_cron_dir):import jsonfrom tools.cronjob_tools import cronjob- out = json.loads(- cronjob(- action="create",- prompt="daily digest",- schedule="every 1h",- reasoning_effort="high",- )- )- assert out["success"] is True- assert out["job"]["reasoning_effort"] == "high"- assert load_jobs()[0]["reasoning_effort"] == "high"-- def test_update_via_tool_sets_and_clears_pin(self, tmp_cron_dir):- import json-- from tools.cronjob_tools import cronjob-- job = _create()- set_out = json.loads(- cronjob(action="update", job_id=job["id"], reasoning_effort="XHIGH")- )- assert set_out["success"] is True- assert load_jobs()[0]["reasoning_effort"] == "xhigh"-- clear_out = json.loads(- cronjob(action="update", job_id=job["id"], reasoning_effort="")- )- assert clear_out["success"] is True- assert load_jobs()[0].get("reasoning_effort") is None-- def test_update_via_tool_garbage_is_clean_tool_error(self, tmp_cron_dir):- import json-- from tools.cronjob_tools import cronjob-- job = _create(reasoning_effort="low")- out = json.loads(- cronjob(action="update", job_id=job["id"], reasoning_effort="turbo")- )- assert out["success"] is False- assert "turbo" in out["error"]- # Stored value untouched by the failed update.- assert load_jobs()[0]["reasoning_effort"] == "low"+ _create(reasoning_effort="high")+ listed = json.loads(cronjob(action="list"))["jobs"][0]+ assert listed["reasoning_effort"] == "high"def test_format_job_omits_field_when_unset(self, tmp_cron_dir):import json@@ -229,14 +191,13 @@ class TestCronjobToolReasoningEffort:listed = json.loads(cronjob(action="list"))["jobs"][0]assert "reasoning_effort" not in listed- def test_schema_exposes_reasoning_effort(self):- from tools.cronjob_tools import CRONJOB_SCHEMA-- prop = CRONJOB_SCHEMA["parameters"]["properties"]["reasoning_effort"]- desc = prop["description"]- # Prompt-surface honesty: the description must state the full level- # grammar, precedence, transport clamping, and the clear semantics.- for level in ("none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"):- assert level in desc- assert "clamp" in desc- assert "empty string" in desc+ def test_schema_does_not_expose_reasoning_effort(self):+ """Policy pin: the model-facing tool schema must NOT offer the+ reasoning_effort knob. Models never choose model config; the CLI is+ the only mutation surface for this field."""+ import inspect++ from tools.cronjob_tools import CRONJOB_SCHEMA, cronjob++ assert "reasoning_effort" not in CRONJOB_SCHEMA["parameters"]["properties"]+ assert "reasoning_effort" not in inspect.signature(cronjob).parametersdiff --git a/tools/cronjob_tools.py b/tools/cronjob_tools.pyindex e01022b5686..b224b87c4ef 100644--- a/tools/cronjob_tools.py+++ b/tools/cronjob_tools.py@@ -1213,7 +1213,6 @@ def cronjob(attach_to_session: Optional[bool] = None,monitor_script: Optional[str] = None,monitor_url: Optional[str] = None,- reasoning_effort: Optional[str] = None,task_id: str = None,session_id: Optional[str] = None,) -> str:@@ -1314,7 +1313,6 @@ def cronjob(attach_to_session=attach_to_session,monitor_script=_normalize_optional_job_value(monitor_script),monitor_url=_normalize_optional_job_value(monitor_url),- reasoning_effort=reasoning_effort,)except CronSchedulerRegistrationError as exc:_partial = exc.to_dict()@@ -1497,10 +1495,6 @@ def cronjob(updates["provider"] = _normalize_optional_job_value(provider)if base_url is not None:updates["base_url"] = _normalize_optional_job_value(base_url, strip_trailing_slash=True)- if reasoning_effort is not None:- # update_job validates against the canonical grammar and- # normalizes; empty string clears the pin.- updates["reasoning_effort"] = reasoning_effort# Re-validate the EFFECTIVE provider/base_url on EVERY update, not# only when this update supplies provider/base_url. A job persisted# before this guard (or written directly to the jobs store) may@@ -1755,10 +1749,6 @@ Scheduling from cron-run sessions is disabled by default and enabled via cron.al"type": "boolean","description": "When True, this job becomes CONTINUABLE: the user can reply to its delivery and the agent has the brief in context instead of asking 'what is that?'. On thread-capable platforms (Telegram topics, Discord/Slack threads) a dedicated thread is opened for the job and its replies; on DM-only platforms (WhatsApp/Signal) the brief is mirrored into the origin DM session. Use this for conversational recurring jobs the user will reply to — daily briefings, reminders that kick off follow-up work. Leave unset for fire-and-forget alerts/watchdogs. Overrides the global cron.mirror_delivery config for this one job. Only the origin chat is touched (never fan-out targets); no effect when deliver='local'."},- "reasoning_effort": {- "type": "string",- "description": "Optional per-job reasoning (thinking) effort pin. One of: none, minimal, low, medium, high, xhigh, max, ultra. When set, it overrides BOTH the global agent.reasoning_effort and per-model agent.reasoning_overrides for this job's runs; 'none' disables thinking. Levels above what the job's resolved model supports are clamped or omitted by the provider at request time, so pinning e.g. 'xhigh' on a model that caps at 'high' runs at 'high'. Inert with no_agent=True (no LLM call). Omit to follow config resolution. On update, pass empty string to clear the pin."- },},"required": ["action"]}@@ -1819,11 +1809,6 @@ registry.register(no_agent=args.get("no_agent"),monitor_script=args.get("monitor_script"),monitor_url=args.get("monitor_url"),- # reasoning_effort IS agent-settable (unlike model/provider above):- # it cannot redirect spend to a different model — it only tunes the- # thinking level within whatever model the job already resolves to,- # and the transports clamp unsupported levels at request time.- reasoning_effort=args.get("reasoning_effort"),task_id=kw.get("task_id"),session_id=kw.get("session_id"),),diff --git a/website/docs/user-guide/features/cron.md b/website/docs/user-guide/features/cron.mdindex 1ba6d0216e4..fa2efc863c7 100644--- a/website/docs/user-guide/features/cron.md+++ b/website/docs/user-guide/features/cron.md@@ -32,7 +32,7 @@ All of this is available to Hermes itself through the `cronjob` tool, so you can::::::tip-**Per-job reasoning effort.** A job can pin its own thinking level, independent of the model pin: one of `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `ultra`. When set, it overrides both the global `agent.reasoning_effort` and per-model `agent.reasoning_overrides` for that job's runs (`none` disables thinking). Set it via the `cronjob` tool (`reasoning_effort: "high"`), or `hermes cron create/edit --reasoning-effort high`; pass an empty string on edit to clear the pin and follow config again. Levels a model doesn't support are clamped or omitted by the provider at request time — pinning `xhigh` on a model that caps at `high` runs at `high`. The pin has no effect on `no_agent` jobs (there is no LLM call to tune). Use it to run heavy scheduled analyses at `high` while cheap recurring jobs run at `minimal`, without touching your global default.+**Per-job reasoning effort.** A job can pin its own thinking level, independent of the model pin: one of `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `ultra`. When set, it overrides both the global `agent.reasoning_effort` and per-model `agent.reasoning_overrides` for that job's runs (`none` disables thinking). Set it via `hermes cron create/edit --reasoning-effort high`; pass an empty string on edit to clear the pin and follow config again. (It is deliberately not exposed on the agent's `cronjob` tool — model configuration stays a user decision.) Levels a model doesn't support are clamped or omitted by the provider at request time — pinning `xhigh` on a model that caps at `high` runs at `high`. The pin has no effect on `no_agent` jobs (there is no LLM call to tune). Use it to run heavy scheduled analyses at `high` while cheap recurring jobs run at `minimal`, without touching your global default.::::::warning