-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Task Scheduling
Version: v0.4.0
Priority: High
Complexity: Medium-Low (well-understood problem)
Dependencies: None
Problem Statement
Users cannot automate task execution on a schedule. Every task must be manually triggered, which prevents:
- Automated daily backups
- Recurring maintenance workflows
- Scheduled deployments during off-peak hours
- Time-based workflow automation
User Stories
Must-Have
- US-1.1: As a DevOps engineer, I want to schedule tasks using standard cron syntax (e.g.,
0 2 * * *), so that I can automate routine maintenance. - US-1.2: As a developer, I want to schedule a one-time task for a future time (ISO 8601), so that I can defer execution to deployment windows.
- US-1.3: As a distributed team member, I want timezone-aware scheduling, so tasks run at the intended local time.
- US-1.4: As an operator, I want to configure missed run behavior (skip/catchup/fail), so I have predictable behavior after outages.
- US-1.5: As a developer, I want to view schedule execution history, so I can audit recurring jobs.
Nice-to-Have (Deferred)
Scope
v1 MVP (In Scope)
- Cron expression parsing (standard 5-field)
- One-time scheduling via ISO 8601 timestamps
- Timezone support (IANA format, default UTC)
- Missed run policies:
skip(default),catchup,fail - New MCP tools:
ScheduleTask,ListSchedules,CancelSchedule - Schedule execution history tracking
- Timer-based execution (check every 60 seconds)
- Persistence across restarts
Deferred (v0.4.1+)
- Dependency integration for scheduled tasks
- DST edge case handling (spring forward ambiguity)
- Schedule modification without recreation
- Sub-minute scheduling (seconds field)
Out of Scope
- Distributed/clustered scheduling
- Calendar integration (Google Calendar, etc.)
- Multi-tenant isolation
Acceptance Criteria
Success Scenarios
- Valid cron expression creates schedule with correct next_run_time
- One-time schedules execute at specified time and don't repeat
- Tasks execute within 60 seconds of scheduled time
- Schedules persist across server restarts
- Schedule history tracks all executions (success/skip/fail)
Failure Scenarios
- Invalid cron expression returns
INVALID_INPUTerror - Past timestamp for one-time schedule returns error
- Invalid timezone returns error with valid options
Edge Cases
- Missed runs handled per policy (skip/catchup/fail)
- Concurrent execution prevented (skip if previous still running)
- Server restart loads all active schedules correctly
Technical Design
New Database Tables
CREATE TABLE scheduled_tasks (
id TEXT PRIMARY KEY,
schedule TEXT NOT NULL,
recurring INTEGER NOT NULL,
timezone TEXT NOT NULL DEFAULT 'UTC',
missed_run_policy TEXT NOT NULL DEFAULT 'skip',
task_config TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'active',
next_run_time INTEGER,
last_run_time INTEGER,
created_at INTEGER NOT NULL
);
CREATE TABLE schedule_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
schedule_id TEXT NOT NULL,
task_id TEXT,
execution_type TEXT NOT NULL,
executed_at INTEGER NOT NULL,
FOREIGN KEY (schedule_id) REFERENCES scheduled_tasks(id)
);New Events
TaskScheduleCreatedTaskScheduleTriggeredTaskScheduleCancelledTaskScheduleFailed
New Components
ScheduleHandler(event handler with timer)ScheduleRepository(SQLite persistence)- MCP tools in
mcp-adapter.ts
Dependencies
- New:
cron-parser(cron expression parsing)
Success Metrics
- Tasks execute within 60 seconds of scheduled time
- Recurring tasks repeat correctly for 30+ days
- Missed runs handled per configured policy
- Schedules survive process restart
Created via /specify command
Reactions are currently unavailable