← Back to PRs

#9467: Cron: support flat params in cron.add tool call

by M00N7682 open 2026-02-05 07:47 View on GitHub →
agents stale
## Summary LLMs (like Qwen 3 Coder) sometimes send job properties as flat params at the top level instead of nesting them in a `job` object. This adds support for both formats: - **Nested** (existing): `{ action: "add", job: { name, schedule, ... } }` - **Flat** (new): `{ action: "add", name, schedule, sessionTarget, payload, ... }` The fix detects if `params.job` is missing but job properties (`schedule`, `payload`, `sessionTarget`) exist at the top level, and constructs the job object from those properties. ## Test plan - [x] Added unit test for flat params format - [x] All existing tests pass (16 tests) Fixes #9283 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the `cron` agent tool to accept `cron.add` parameters in either the existing nested format (`{ action: "add", job: {...} }`) or a new flat format (`{ action: "add", name, schedule, sessionTarget, payload, ... }`). It adds a unit test covering the flat format and adjusts the add-path to normalize whichever input shape is provided before calling the gateway’s `cron.add`. <h3>Confidence Score: 4/5</h3> - Mostly safe to merge, but a couple input-shape edge cases can cause incorrect cron.add payloads or unexpected errors. - Change is small and has test coverage for the main new behavior, but the flat-param conversion currently forwards unrelated tool keys into the job payload and uses truthiness for detection, both of which can produce deterministic failures for certain inputs. - src/agents/tools/cron-tool.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs