Repository navigation
fix(cron): recover whitespace-padded tool keys before validation - #95427
ZengWen-DT wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 20, 2026, 7:58 PM ET / 23:58 UTC. Summary PR surface: Source +21, Tests +46. Total +67 across 2 files. Reproducibility: yes. as a source-reproducible path: current-main cron canonicalization leaves Review metrics: none identified. 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 detailsBest possible solution: Land one narrow cron canonicalizer fix for the trailing-space key shape while keeping gateway schemas strict; this PR is a strong candidate if exact-head checks complete cleanly. Do we have a high-confidence way to reproduce the issue? Yes, as a source-reproducible path: current-main cron canonicalization leaves Is this the best way to solve the issue? Yes. The existing cron tool canonicalizer is the narrowest maintainable layer because related local-parser key recovery already lives there, while global JSON parsing or gateway schema loosening would broaden the blast radius. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 22bdda25551e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +21, Tests +46. Total +67 across 2 files. View PR surface stats
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
|
What Problem This Solves
Fixes #95407. Some small/local model tool-call serializers emit valid JSON for the
crontool'saddaction where specific top-level keys in thejobobject carry trailing whitespace —"schedule ","sessionTarget ","payload ","enabled "— while keys likename/descriptionand nested keys stay intact. The gatewaycron.addschema is strict (additionalProperties: false), so these padded keys make the call fail validation with "must have required properties schedule, sessionTarget, payload", and the job is never created.Why This Change Was Made
The cron tool already canonicalizes model-friendly/malformed shorthands before strict gateway validation in
src/agents/tools/cron-tool-canonicalize.ts— including a siblingrepairConcatenatedCronToolKeysrecovery for an earlier local-model key-corruption shape (concatenated keys). The trailing-space variant is the same class of defect at the same boundary, so the narrowest, consistent fix is a sibling recovery step in that canonicalizer rather than loosening the gateway schema or touching shared cross-provider JSON parsing.repairWhitespacePaddedCronToolKeystrims each top-level key and, only when the trimmed name is a known cron key, renames it onto the canonical key. It deliberately skips renaming when the canonical key already exists, so a genuine duplicate (e.g. bothenabledand"enabled ") is left for strict validation to reject instead of being silently merged.User Impact
Local/non-frontier models that pad cron
jobkeys with whitespace can now successfully create scheduled jobs through thecrontool. Gateway validation stays strict; no config, schema, or migration changes. Frontier models that already emit clean keys are unaffected (the trim loop is a no-op when no padded known keys are present).Evidence
Real-behavior proof: drove the actual production
canonicalizeCronToolObjectplus the real strict gateway validatorvalidateCronAddParams(@openclaw/gateway-protocol) on the reporter's exact mangled payload. The mangled (trailing-space) input is rejected before the fix path and the recovered output is accepted after:Added regression tests through the full
crontool execute path insrc/agents/tools/cron-tool.test.ts:Test run (worktree-safe runner, full cron-tool suite):
Formatting (
oxfmt --check) and lint (oxlint) pass on both touched files.AI-assisted.