Skip to content

fix(cron): reject invalid schedule parameters at creation time#4285

Open
yorkhellen wants to merge 1 commit into
HKUDS:mainfrom
yorkhellen:fix/cron-validate-expr
Open

fix(cron): reject invalid schedule parameters at creation time#4285
yorkhellen wants to merge 1 commit into
HKUDS:mainfrom
yorkhellen:fix/cron-validate-expr

Conversation

@yorkhellen

Copy link
Copy Markdown
Contributor

Summary

  • Extend _validate_schedule_for_add to validate all schedule kinds upfront: reject invalid/empty cron expressions (croniter.is_valid), non-positive every_ms, missing at_ms, and tz used with non-
    cron schedules
  • Catch ValueError in CronTool._add_job and return a user-facing error string instead of letting the exception propagate into the tool execution flow
  • Previously, an invalid cron expression like "not a cron" would silently create a job with next_run_at_ms=None that would never execute — the user/agent would see "Created job" with no indication of failure

Test plan

  • 7 new service-layer tests: invalid cron expr, empty cron expr, every_ms <= 0, negative every_ms, missing at_ms, tz with every, tz with at
  • 2 new tool-layer tests: invalid cron expr returns Error:, empty cron expr returns Error:
  • All 88 cron tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant