Skip to content

fix(cron): reject invalid one-shot timestamps - #997

Open
lewismosciski wants to merge 1 commit into
modelscope:mainfrom
lewismosciski:fix/cron-validate-once-timestamps
Open

lewismosciski wants to merge 1 commit into
modelscope:mainfrom
lewismosciski:fix/cron-validate-once-timestamps

Conversation

@lewismosciski

Copy link
Copy Markdown

Change Summary

ms-agent cron create '2025-02-30T09:00:00' 'test' currently saves a job that the scheduler silently skips forever. The parser checks only the timestamp prefix.

Validate one-shot timestamps with datetime.fromisoformat() before creating the schedule. Invalid dates, times and trailing text now raise ValueError; valid timestamps retain their original representation.

Validation: python -m pytest tests/cron -q (108 passed); changed-file pre-commit passed. CLI checks confirm that an invalid date exits with an error without saving a job, and a valid timestamp with a UTC offset is saved. Full-repo pre-commit has existing failures on main, including ms_agent/config/skills_manager.py:61 and ms_agent/permission/shell_validator.py:91.

Related issue number

None; found while checking the cron parser and scheduler.

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check. Ran both; full-repo failures noted above.
  • Documentation reflects the changes where applicable (no new command or configuration)

This branch has not been deployed

No deployments
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