From 2fcbc6a13eff2b45f55481fc788f69012428343c Mon Sep 17 00:00:00 2001 From: ygd58 Date: Tue, 26 May 2026 08:35:18 +0200 Subject: [PATCH 1/2] fix(cron): clarify schedule is required for create in tool schema Grok models (and other LLMs) sometimes omit the schedule parameter when calling the cronjob tool with action=create because the schema only listed 'action' in required[] and the schedule description did not explicitly state it was mandatory (issue #32427). Fix: update schema descriptions to clearly state schedule is REQUIRED for action=create, making this explicit for models that rely on description text for parameter compliance. Fixes #32427 --- tools/cronjob_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cronjob_tools.py b/tools/cronjob_tools.py index c62eb4ba1c4e5..18c68a7ce91e3 100644 --- a/tools/cronjob_tools.py +++ b/tools/cronjob_tools.py @@ -706,7 +706,7 @@ def cronjob( "properties": { "action": { "type": "string", - "description": "One of: create, list, update, pause, resume, remove, run" + "description": "One of: create, list, update, pause, resume, remove, run. When action=create, the 'schedule' and 'prompt' fields are REQUIRED." }, "job_id": { "type": "string", @@ -718,7 +718,7 @@ def cronjob( }, "schedule": { "type": "string", - "description": "For create/update: '30m', 'every 2h', '0 9 * * *', or ISO timestamp" + "description": "REQUIRED for action=create. For create/update: '30m', 'every 2h', '0 9 * * *', or ISO timestamp. Examples: '30m' (every 30 minutes), 'every 2h' (every 2 hours), '0 9 * * *' (daily at 9am), '2026-06-01T09:00:00' (one-shot). You MUST include this field when action=create." }, "name": { "type": "string", From 5cd1978d8163b458dc1c710207df4cb948c76683 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 26 May 2026 13:41:02 -0700 Subject: [PATCH 2/2] test(cron): guard schedule-required description text on CRONJOB_SCHEMA --- tests/cron/test_cronjob_schema.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/cron/test_cronjob_schema.py diff --git a/tests/cron/test_cronjob_schema.py b/tests/cron/test_cronjob_schema.py new file mode 100644 index 0000000000000..ec98c9479de93 --- /dev/null +++ b/tests/cron/test_cronjob_schema.py @@ -0,0 +1,41 @@ +"""Tests for the cronjob tool schema shape. + +Guards the description text that flags ``schedule`` (and ``prompt``) as +REQUIRED for ``action=create`` — the load-bearing fix for description-driven +models (e.g. Grok) that omit schedule when the schema only lists ``action`` +in ``required[]``. See issue #32427 / PR #32448. +""" + +from __future__ import annotations + + +def test_cronjob_schema_action_description_flags_create_requirements(): + """`action` description must state schedule + prompt are required for create.""" + from tools.cronjob_tools import CRONJOB_SCHEMA + + action_desc = CRONJOB_SCHEMA["parameters"]["properties"]["action"]["description"] + assert "action=create" in action_desc + assert "schedule" in action_desc + assert "REQUIRED" in action_desc + + +def test_cronjob_schema_schedule_description_flags_required_for_create(): + """`schedule` description must explicitly state REQUIRED for action=create.""" + from tools.cronjob_tools import CRONJOB_SCHEMA + + schedule_desc = CRONJOB_SCHEMA["parameters"]["properties"]["schedule"]["description"] + assert "REQUIRED" in schedule_desc + assert "action=create" in schedule_desc + + +def test_cronjob_schema_required_array_unchanged(): + """`required[]` stays minimal — `action` only. + + The schema intentionally does NOT promote schedule/prompt into the + top-level required array because they're only mandatory for + action=create, not for list/remove/pause/etc. The description text + carries the conditional requirement instead. + """ + from tools.cronjob_tools import CRONJOB_SCHEMA + + assert CRONJOB_SCHEMA["parameters"]["required"] == ["action"]