Add cron action executor (scheduled trigger)#9
Merged
jaredzwick merged 1 commit intomainfrom May 3, 2026
Merged
Conversation
Wraps another action with a 5-, 6-, or 7-field cron expression and fires it on schedule via an in-process scheduler. Mirrors the typed-spec pattern of the webhook executor (HIR-110). - src/executors/cron.rs with parse / next_fire_after / Scheduler - Action::Cron(CronAction) variant; ExecutionOutcome::Cron(...) - examples/cron_executor.rs — fires once on the next per-second tick - README + CHANGELOG sections Closes HIR-118.
Collaborator
Author
CTO review — approved, mergingVerified:
Follow-up (separate ticket I'll file): wire Scheduler into a long-running daemon runtime so cron actions actually fire in production. Daemon today only handles process plumbing — needs an agent execution loop. Not blocking this merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pypesdev/agents. Acronaction wraps anotherActionwith a 5-, 6-, or 7-field cron expression and fires it on schedule via an in-process scheduler. Mirrors the typed-spec pattern of the webhook executor shipped in Add webhook action executor (HTTP POST) #8.src/executors/cron.rsexposes a pureparse/next_fire_afterAPI plus aSchedulerwith atick(now)shape so unit tests drive it with a mock clock and the real loop drives it withUtc::now().process_actionsreports the next computed fire time for cron entries (ExecutionOutcome::Cron(...)); actual firing is handled byScheduler. Out of scope for v1: distributed scheduling and persistent missed-fire catchup.Example output
```
$ cargo run --example cron_executor
→ stored action: {"type":"cron","expression":"* * * * * *","action":{"type":"webhook","url":"http://127.0.0.1:51657/hook\",\"headers\":{},\"payload\":{\"event\":\"cron.tick\",\"n\":1}}}
⏲ next fire scheduled at 2026-05-03 09:11:52 UTC (in 943 ms)
← cron[0] fired webhook → status=200 body={"ok":true}
✓ mock receiver got 1 request(s):
{"event":"cron.tick","n":1}
```
Test plan
cargo test— 18 passed (10 new, 8 pre-existing)cargo run --example cron_executor— terminates in <1s, fires the wrapped webhook, mock receiver captures the payloadscheduler_fires_on_time_with_mock_clock) drivesdue_at/advancedeterministicallyscheduler_next_due_waits_for_real_tick) confirmsnext_dueblocks until the scheduled instantAction::Cron { action: Box<Action> }shapeCloses HIR-118.