2.8 KiB
2.8 KiB
summary, owner, status, last_updated
| summary | owner | status | last_updated |
|---|---|---|---|
| Harden cron.add input handling, align schemas, and improve cron UI/agent tooling | clawdbot | complete | 2026-01-05 |
Cron Add Hardening & Schema Alignment
Context
Recent gateway logs show repeated cron.add failures with invalid parameters (missing sessionTarget, wakeMode, payload, and malformed schedule). This indicates that at least one client (likely the agent tool call path) is sending wrapped or partially specified job payloads. Separately, there is drift between cron provider enums in TypeScript, gateway schema, CLI flags, and UI form types, plus a UI mismatch for cron.status (expects jobCount while gateway returns jobs).
Goals
- Stop
cron.addINVALID_REQUEST spam by normalizing common wrapper payloads and inferring missingkindfields. - Align cron provider lists across gateway schema, cron types, CLI docs, and UI forms.
- Make agent cron tool schema explicit so the LLM produces correct job payloads.
- Fix the Control UI cron status job count display.
- Add tests to cover normalization and tool behavior.
Non-goals
- Change cron scheduling semantics or job execution behavior.
- Add new schedule kinds or cron expression parsing.
- Overhaul the UI/UX for cron beyond the necessary field fixes.
Findings (current gaps)
CronPayloadSchemain gateway excludessignal+imessage, while TS types include them.- Control UI CronStatus expects
jobCount, but gateway returnsjobs. - Agent cron tool schema allows arbitrary
jobobjects, enabling malformed inputs. - Gateway strictly validates
cron.addwith no normalization, so wrapped payloads fail.
What changed
cron.addandcron.updatenow normalize common wrapper shapes and infer missingkindfields.- Agent cron tool schema matches the gateway schema, which reduces invalid payloads.
- Provider enums are aligned across gateway, CLI, UI, and macOS picker.
- Control UI uses the gateway’s
jobscount field for status.
Current behavior
- Normalization: wrapped
data/jobpayloads are unwrapped;schedule.kindandpayload.kindare inferred when safe. - Defaults: safe defaults are applied for
wakeModeandsessionTargetwhen missing. - Providers: Discord/Slack/Signal/iMessage are now consistently surfaced across CLI/UI.
See docs/cron-jobs.md for the normalized shape and examples.
Verification
- Watch gateway logs for reduced
cron.addINVALID_REQUEST errors. - Confirm Control UI cron status shows job count after refresh.
Optional Follow-ups
- Manual Control UI smoke: add a cron job per provider + verify status job count.
Open Questions
- Should
cron.addaccept explicitstatefrom clients (currently disallowed by schema)? - Should we allow
webchatas an explicit delivery provider (currently filtered in delivery resolution)?