feat: add scheduled tasks / cron system#63
Merged
priyanshujain merged 29 commits intomasterfrom Mar 12, 2026
Merged
Conversation
Allows tests to inject mock pushers and custom agent runners without requiring real Telegram/Slack bots or config-based LLM setup.
…d worker execution
Prevents double-completion race between pollOneShot and the worker. The scheduler now only disables the schedule; the worker marks it completed after successful execution.
…ding Pusher creation and push failures now return errors so River can retry the job, and record the error in last_run.
…anSchedule Previously parseTime silently returned nil on unparseable strings and channel_meta unmarshal errors were ignored.
Use parameterized queries instead of literal 1/0 for the enabled
column, and scan via interface{} to handle both SQLite INTEGER and
Postgres BOOLEAN types.
…round Ensures cron-triggered job inserts respect shutdown signals.
6 tasks
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
robfig/cron/v3for recurring schedules and a 30s poll loop for one-shot tasksNew components
source/scheduler/— Types, schema (SQLite + Postgres), and CRUD storechannel/push*.go—Pusherinterface with Telegram and Slack implementations + factoryagent/tools/auto_approve.go—AutoApproveInteractorfor headless task executionagent/tools/schedule.go—create_schedule,list_schedules,delete_scheduletoolsdaemon/scheduler.go— Core scheduler with cron engine, one-shot polling, and DB reloaddaemon/jobs/scheduled_task.go— River worker that runs agents and pushes resultsskills/schedule-task/— Skill definition and reference docsModified files
config/config.go—SchedulerConfig, DSN helper, defaultsdaemon/river.go— RegisterScheduledTaskWorkerdaemon/daemon.go— Wire scheduler start/stop into daemon lifecycleagent/tools/prompt.go— Conditional "Scheduled Tasks" system prompt sectionchannel/telegram/session.go— Register schedule tools in Telegram agentchannel/telegram/telegram.go— AddChatID()accessorinternal/server/server.go— Add scheduler migration to startupValidations
time.LoadLocation()scheduled_atmust be in the futureTest plan
source/scheduler/— Types JSON round-trip, schema migration, full CRUD round-trip, ListDueOneShot with past/future, MarkCompletedagent/tools/— Create recurring/one-shot, invalid timezone, too-frequent cron, past one-shot, list + delete round-tripagent/tools/— AutoApproveInteractor returns truedaemon/— isValidFrequency, loadSchedules add/remove entries, one-shot integration testdaemon/jobs/— ScheduledTaskArgs Kind() and JSON serializationchannel/— Pusher interface compliance, factory error for unsupported channelgo test ./...— only pre-existing external API failures)