Commit Graph

12 Commits

Author SHA1 Message Date
Xubin Ren
5bd1c9ab8f fix(cron): preserve exact intervals in list output 2026-03-18 12:39:06 +08:00
PJ Hoberman
8d45fedce7 refactor(cron): extract _format_timing and _format_state helpers
Addresses review feedback: moves schedule formatting and state
formatting into dedicated static methods, removes duplicate
in-loop imports, and simplifies _list_jobs() to a clean loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 12:39:06 +08:00
PJ Hoberman
228e1bb3de style: apply ruff format to cron tool
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 12:39:06 +08:00
PJ Hoberman
eb83778f50 fix(cron): show schedule details and run state in _list_jobs() output
_list_jobs() only displayed job name, id, and schedule kind (e.g. "cron"),
omitting the actual timing and run state. The agent couldn't answer
"when does this run?" or "did it run?" even though CronSchedule and
CronJobState had all the data.

Now surfaces:
- Cron expression + timezone for cron jobs
- Human-readable interval for every jobs
- ISO timestamp for one-shot at jobs
- Enabled/disabled status
- Last run time + status (ok/error/skipped) + error message
- Next scheduled run time

Fixes #1496

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 12:39:06 +08:00
Kiplangatkorir
edaf7a244a fix: handle invalid ISO datetime in CronTool gracefully
datetime.fromisoformat(at) raises ValueError for malformed strings,
which propagated uncaught and crashed the tool execution. Now catches
ValueError and returns a user-friendly error message instead.
2026-03-04 10:55:17 +03:00
Re-bin
30803afec0 fix(cron): isolate cron-execution guard with contextvars 2026-03-03 05:36:48 +00:00
Nikolas de Hor
da8a4fc68c fix: prevent cron job execution from scheduling new jobs
When a cron job fires, the agent processes the scheduled message and
has access to the cron tool. If the original message resembles a
scheduling instruction (e.g. "remind me in 10 seconds"), the agent
would call cron.add again, creating an infinite feedback loop.

Add a cron-context flag to CronTool that blocks add operations during
cron job execution. The flag is set before process_direct() and cleared
in a finally block to ensure cleanup even on errors.

Fixes #1441
2026-03-03 01:02:33 -03:00
JK_Lu
977ca725f2 style: unify code formatting and import order
- Remove trailing whitespace and normalize blank lines
- Unify string quotes and line breaks for long lines
- Sort imports alphabetically across modules
2026-02-28 20:55:43 +08:00
Re-bin
6bae6a617f fix(cron): fix timezone display bug, add tz validation and skill docs 2026-02-17 08:30:52 +00:00
jopo
ae903e983c fix(cron): improve timezone scheduling and tz propagation 2026-02-16 17:49:19 -08:00
3927o
a66fa650a1 feat(cron): add 'at' parameter for one-time scheduled tasks 2026-02-12 11:06:57 +08:00
Re-bin
b1d6670ce0 feat: add cron tool for scheduling reminders and tasks 2026-02-05 15:09:51 +00:00