#23221: fix(cron): recover flat patch params for update action and fix schema
agents
size: S
Cluster:
Swarm Bug Fixes and Feature Requests
## Summary
- Recovers flat `patch` parameters for the `update` action in `cron-tool.ts`.
- Fixes a syntax error (missing braces) in `CronToolSchema` that could lead to runtime validation issues.
- Adds E2E tests verifying recovery for `name` and `enabled` fields when flattened at the top level.
## Context
Smaller models (such as Qwen and Ollama running locally on WSL) frequently struggle with complex nested JSON schemas. They often flatten parameters directly into the top-level arguments object rather than nesting them under the expected keys (e.g., `patch`). This change brings the same resilience to the `update` action that was recently added to the `add` action, ensuring consistent behavior across different LLM providers.
## Verification
- Ran 32/32 tests in `src/agents/tools/cron-tool.e2e.test.ts` using `vitest.e2e.config.ts`.
- All tests passed, including the new `recovers flat patch params for update action` test case.
## AI-assisted
- [x] Generated with Gemini Antigravity
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds flat parameter recovery for the `update` action and fixes a schema definition issue. The changes mirror the existing flat parameter recovery pattern from the `add` action, allowing smaller models to pass parameters at the top level instead of nested under `patch`.
- Fixed `CronToolSchema` by adding missing `{ additionalProperties: true }` option, which is required for the schema to accept flat parameters
- Added recovery logic for `update` action that detects when `patch` is missing or empty and rebuilds it from top-level parameters
- Includes E2E test verifying recovery for `name` and `enabled` fields
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes follow an established pattern from the `add` action, fix a schema definition bug, and include comprehensive test coverage. The implementation is straightforward and backward-compatible.
- No files require special attention
<sub>Last reviewed commit: d3d0ab5</sub>
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#9430: fix: accept flat params for cron.add tool action
by dbottme · 2026-02-05
81.6%
#9467: Cron: support flat params in cron.add tool call
by M00N7682 · 2026-02-05
79.1%
#18743: Cron Tool Hardening: Normalize Gateway Params and Enforce Valid Sch...
by cccat6 · 2026-02-17
77.7%
#21190: test(cron-cli): assert cron.update patch schedule.staggerMs on edit
by ethvilet · 2026-02-19
76.9%
#12642: feat(tools): typed tool schemas for xAI/Grok compatibility
by 2nd-ren · 2026-02-09
75.4%
#2071: fix: accept JSON string for cron.add job parameter (#1940)
by andrescardonas7 · 2026-01-26
74.6%
#4767: fix(agents): handle read alias required schema
by RomeroYang · 2026-01-30
73.5%
#22214: fix(tools): sanitize google-antigravity schemas for Gemini-compatib...
by Kansodata · 2026-02-20
73.4%
#8307: fix(cron): improve tool description with reliable reminder guidance
by vishaltandale00 · 2026-02-03
73.0%
#13694: feat(cron): structured output via responseSchema for isolated agent...
by JordanCoin · 2026-02-10
72.6%