fix(tools): improve cronjob tool descriptions to prevent missing required params - #34173
fix(tools): improve cronjob tool descriptions to prevent missing required params#34173teixeirazeus wants to merge 2 commits into
Conversation
…rams Root cause: the CRONJOB_SCHEMA uses allOf/if/then at the parameters top level to conditionally require schedule/job_id based on action, but schema_sanitizer strips allOf from the top level for strict backend compatibility (OpenAI Codex rejects allOf there). The model therefore only sees 'required: ["action"]' and treats schedule as optional, leading to 'schedule is required for create' errors. Fix: - Add explicit REQUIRED PARAMETERS table to the action parameter description so every model sees which params are needed per action. - Strengthen schedule/prompt descriptions with REQUIRED/CRITICAL markers. - Move canonical_skills before the schedule validation so the error message can include it for debugging. - Improve the schedule validation error message to include the actual received values (schedule, prompt, skills) so failed calls are debuggable even when the model doesn't echo what it sent. Closes NousResearch#34120
608ada0 to
e6b764e
Compare
Adds scripts/reproduce_34120.sh that demonstrates the full chain: 1) Schema before sanitization (allOf present) 2) Schema after sanitization (allOf stripped) 3) Call without schedule fails 4) Call with schedule succeeds Verifiable by running: bash scripts/reproduce_34120.sh
|
Thanks for this @teixeirazeus — your diagnosis of the sanitizer stripping top-level Closing as redundant: the description-driven fix for this bug class already landed on Your PR's remaining delta over |
Summary
Fixes #34120 —
cronjobtool:action=createfails with "schedule is required for create" even when the model intends to provide a schedule.Root Cause
The JSON Schema for the
cronjobtool usesallOfwithif/then/elseat the top level ofparametersto conditionally requireschedulewhenaction=create:However, the schema sanitizer (
tools/schema_sanitizer.py, line 96) defines_TOP_LEVEL_FORBIDDEN_KEYS = ("allOf", "anyOf", "oneOf", "enum", "not")and strips these from the top-level parameters object (line 127:out.pop(key, None)) for compatibility with strict backends like OpenAI's Codex endpoint.After sanitization, the model receives only:
scheduleappears optional in the schema. When a model like Grok 4.3 (the reporter's model) receives this sanitized schema, it infers it can omitschedule. The handler then rejects the call with the error message users are seeing.The
allOfhint was well-intentioned but ineffective — it was silently discarded before ever reaching the LLM.Solution
Three changes in
tools/cronjob_tool.py— all in non-functional metadata (descriptions and error messages):1.
actionparameter descriptionNow contains an explicit human-readable table mapping each action value to its required parameters:
2.
scheduleparameter descriptionReinforced with REQUIRED/CRITICAL markers:
3. Improved error message
The rejection now includes the received values for debugging:
Changes Made
tools/cronjob_tools.pyactiondescription with required-params tabletools/cronjob_tools.pyscheduledescription with REQUIRED/CRITICAL markerstools/cronjob_tools.pyHow to Test
Focused unit tests
Result:
Manual reproduction (script included)
This script demonstrates the full chain:
allOfis present with 3 conditionsallOfis removed, onlyrequired: ["action"]remainsOutput:
Full suite check
All 474 cron-related tests pass across 18 test files.
Why not fix the sanitizer instead?
The sanitizer strips
allOffor a reason: the OpenAI Codex endpoint strictly rejects schemas with top-level combinators. Fixing the sanitizer would break Codex compatibility. Since theallOfwas the only hint the model had, and it was silently discarded, the descriptions are the correct fix — they survive sanitization and reach every backend.Checklist
fix(scope):)pytest tests/ -qand all tests pass