Repository navigation
fix #95407: [Bug]: cron tool add action mangles certain key names in job parameter - #95453
mikasa0818 wants to merge 3 commits into
Conversation
|
Codex review: needs changes before merge. Reviewed June 22, 2026, 12:42 AM ET / 04:42 UTC. Summary PR surface: Source +35, Tests +160. Total +195 across 3 files. Reproducibility: yes. Source inspection shows current main and v2026.6.9 do not recover whitespace-padded cron keys before strict CronAddParamsSchema validation; I did not run the live qwen35b/llamacpp route in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land one cron-scoped fix that recovers only recognized padded cron keys, preserves duplicate conflicts for strict validation, and passes lint/checks; this branch needs the Object.hasOwn repair first. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main and v2026.6.9 do not recover whitespace-padded cron keys before strict CronAddParamsSchema validation; I did not run the live qwen35b/llamacpp route in this read-only review. Is this the best way to solve the issue? Yes for the product fix boundary: the cron tool canonicalizer is the narrowest maintainable place because existing malformed cron argument recovery already lives there. The submitted branch still needs the lint repair before it can be considered merge-ready. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a594d2ce7325. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +35, Tests +160. Total +195 across 3 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Thanks @mikasa0818 for the work on this. Clownfish is closing #95453 because the same #95407 cron key repair has now landed in #95674. The merged fix trims recognized whitespace-padded cron job keys and preserves duplicate padded keys so validation can still reject conflicts. This branch helped validate the same failure mode, and the cleanup record keeps its context as a source PR with credit/attribution alongside the merged fix. Original issue: #95407. If this branch covers a different reproduction path that still fails on current main, please reply and we can reopen or split it back out. |
What Problem This Solves
Fixes #95407.
cron.addrejected local parser outputs where recognized top-level job keys had trailing spaces, such asschedule,sessionTarget,payload, andenabled.Summary
Recover whitespace-padded top-level cron job keys before
cron.addgateway validation. This keeps the gateway schema strict while allowing the cron tool's existing model-friendly canonicalization seam to repair a concrete parser corruption shape.The update also preserves ambiguous duplicate input when both a canonical key and its whitespace-padded duplicate are present. In that case the padded duplicate remains on the normalized object so strict
CronAddParamsSchemavalidation rejects the extra property instead of silently choosing one value.For flat
cron.addinputs, recovered synthetic jobs/patches are not canonicalized a second time. This keeps moved flat shorthand conflicts such ascron+cronandallowUnsafeExternalContent+allowUnsafeExternalContentvisible to final strict validation instead of re-recovering the padded shorthand and overwriting nestedscheduleorpayloadvalues.Root Cause
canonicalizeCronToolObjectonly recovered the earlier concatenated-key corruption shape (namePayload,scheduleKind,sessionTargetName). It copied whitespace-padded keys as-is, so strict gateway validation saw missing canonical fields plus unexpected padded fields.cron.addpath canonicalized the synthetic job again. For flat shorthands moved intoscheduleorpayload, that second pass could recover the remaining padded shorthand and overwrite the nested canonical value before strict validation saw the duplicate.Why This Change Was Made
The gateway schema is the source of truth and should continue rejecting unknown fields. This patch trims only property names whose trimmed form is already a known cron job/patch/recovery field; unsupported fields remain unsupported. Flat cron parameter recovery uses the same known-key normalization so flat and nested job inputs handle this whitespace-padded key shape consistently. If a parser supplies both
enabledandenabled, or both a flat shorthand such ascronandcron/allowUnsafeExternalContentandallowUnsafeExternalContent, the padded duplicate is not discarded or re-applied; strict validation rejects the extra property.Real behavior proof
pnpm exec oxfmt --check --threads=1 src/agents/tools/cron-tool.ts src/agents/tools/cron-tool-canonicalize.ts src/agents/tools/cron-tool.test.tsnode scripts/run-vitest.mjs src/agents/tools/cron-tool.test.ts src/agents/tools/cron-tool.flat-params.test.tspnpm test src/agents/tools/cron-tool.test.ts src/agents/tools/cron-tool.flat-params.test.tsgit diff --checkpnpm exec tsx --input-type=modulewith productioncanonicalizeCronToolObject,recoverCronObjectFromFlatParams,normalizeCronJobCreate,createCronTool, and gateway protocolCronAddParamsSchemaagainst padded-only, duplicate/conflicting padded-key, and flat shorthand duplicate cron add shapes.joband flatcron.addinputs with padded top-level cron keys; nested and flat duplicateenabledinputs; a flat schedule shorthand duplicate (cron+cron); and a flat security-sensitive payload shorthand duplicate (allowUnsafeExternalContent+allowUnsafeExternalContent). The strict schema proof produced canonical keys andschema.accepted: truefor padded-only input. For duplicate nested and flat inputs it preserved the canonical value, kept the padded duplicate as an additional top-level property, andCronAddParamsSchemarejected the payload with the expectedadditionalPropertiesentry.Evidence
node scripts/run-vitest.mjs src/agents/tools/cron-tool.test.ts src/agents/tools/cron-tool.flat-params.test.tspassed.pnpm test src/agents/tools/cron-tool.test.ts src/agents/tools/cron-tool.flat-params.test.tspassed: 136 tests passed across 2 files.createCronTooldispatch.git diff --checkpassed.Regression Test Plan
src/agents/tools/cron-tool.test.ts.cron.addwith ajobobject whose top-levelschedule,sessionTarget,payload, andenabledkeys have trailing spaces.cron.addinput with those whitespace-padded fields recovered into a job before dispatch.joband flatcron.addinputs containingenabledplusenabled, and asserts strictCronAddParamsSchemarejects the outgoingcron.addparams because the padded duplicate remains an additional property.cronpluscronandallowUnsafeExternalContentplusallowUnsafeExternalContentso moved schedule and payload fields cannot be overwritten by a second canonicalization pass.Review findings addressed
status: ⏳ waiting on author): addressed by this update; the PR body documents the author-side flat-shorthand fix, regression coverage, and verification results.src/agents/tools/cron-tool.test.tscoverscronpluscronandallowUnsafeExternalContentplusallowUnsafeExternalContent.allowUnsafeExternalContentsecurity-sensitive overwrite): fixed and covered. Regression and production-path proof preservepayload.allowUnsafeExternalContent: falsewhile keeping top-levelallowUnsafeExternalContent : trueas an additional property rejected by strict validation.src/agents/tools/cron-tool-canonicalize.ts:309-312/ keep flat shorthand duplicates rejectable): fixed by avoiding duplicate canonicalization of already-recovered flat cron objects before gateway submission.node scripts/run-vitest.mjs src/agents/tools/cron-tool.test.ts src/agents/tools/cron-tool.flat-params.test.ts): passed.pnpm exec oxfmt --check --threads=1 src/agents/tools/cron-tool-canonicalize.ts src/agents/tools/cron-tool.test.ts): passed. I also checkedsrc/agents/tools/cron-tool.ts, which is touched by the final dispatch fix.git diff --check): passed.Merge risk
merge-risk:low/ no compatibility-expanding protocol change.