fix: Schedules: store + schedule/list/cancel verbs + timer (delete old scheduler) #67
No reviewers
Labels
No labels
epic
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie!67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-60"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replace the static
[[schedule]]config-based scheduler with dynamic, persisted Schedules — aScheduleis a persisted instruction to run a delivery Verb (send/prompt/run) against a frozen chat at a future time.What changed:
New
src/schedule.rsmodule —Timingenum (In/At/Cron),Schedulestruct,ScheduleStorewith atomic-temp+rename persistence toschedules.json, pure fire-decision functions (next_fire,is_due,is_missed_oneshot), andgenerate_handle. All firing-time logic is isolated from tokio::sleep.New CLI verbs —
evie schedule (--in|--at|--cron) [--name] [--update] [--chat] -- <verb> [args…],evie list [--json] [--chat],evie cancel --name <n> [--chat]. Clap enforces mutual exclusivity of timing flags.--namecollision without--updateerrors; omitted name generates and prints a hex handle.Control plane CRUD —
ControlRequest::Schedule/List/Cancelvariants with validation (verb whitelist, per-chat name scoping, upsert semantics). Human-readable table forlist, raw JSON with--json.Schedule timer —
schedule_timerreplaces the oldscheduler_task. It sleeps until the earliest next fire (capped at 1h for responsiveness), thentake_dueatomically fires one-shots (removing them) and leaves cron schedules. A missed one-shot fires late and flags"⏰ due at T (evie was offline)"; cron schedules always fire at the next occurrence.Fire-time dispatch —
fire_schedulere-dispatches the stored argv in-process through the same paths as immediate verbs.rungetsEVIE_SCHEDULE_NAMEandEVIE_SCHEDULE_TIME(ISO 8601 local) injected.Removals —
[[schedule]]config table,ScheduleConfig,scheduler_task,DeliverySendertype alias. A config that still contains[[schedule]]starts without error (serde unknown field).Dependencies —
croneradded toCargo.tomlfor cron expression parsing.Tests — Timing edge cases (future/elapsed/cron/next-occurrence/downtime-missed), store round-trip (insert/get/update/remove/list/take-due), control-plane CRUD (collision→error, upsert, per-chat scoping, cancel not-found), handle generation, CLI serialization round-trip.
Closes #60
087be933416408f915c76408f915c7af7b1315da