Workers
Cron and scheduler
The cron backbone is two workers. ultron-cron is the master firer for fixed-schedule platform jobs (reconciler, janitor, lifecycle emails). ultron-cron-scheduler reads dynamic schedule definitions from the app database and dispatches per-workspace recurring tasks at their configured times.
Updated today
Overview
At a glance
- Master firer
ultron-cron- Dispatcher
ultron-cron-scheduler- Trigger style
- Both use the edge runtime's native cron triggers
- Webhook secret
- Shared with the app for signed POSTs
- Dispatched endpoint
POST /api/cron/<handler>on the app
Two workers
Static schedules vs dynamic schedules.
| Concern | ultron-cron | ultron-cron-scheduler |
|---|---|---|
| Driven by | Fixed cron expressions in wrangler.toml | Rows in the schedules table |
| Tick frequency | Per-handler (5 min, hourly, daily, ...) | Every minute |
| What it fires | Platform jobs (reconciler, janitor, lifecycle emails) | User-defined recurring tasks (scheduled agents, scheduled posts, scheduled crawls) |
| Modifiable at runtime | No (wrangler deploy required) | Yes (write to schedules table) |
| Multi-tenant | No | Yes |
Worker shape
ultron-cron/wrangler.tomltoml
ultron-cron-scheduler/wrangler.tomltoml
Schedule catalogue
What ultron-cron fires by default.
| Cron | Handler | What it does |
|---|---|---|
| */5 * * * * | reconciler | Walks workspaces with stalled jobs, retries up to 3 attempts |
| 0 * * * * | janitor | Drops expired sandbox sessions, cleans /work R2 snapshots older than 7 days |
| 0 9 * * * | lifecycle-emails | Sends day-1, day-7, day-14, day-30 lifecycle emails based on user activity |
| 15 * * * * | metrics-rollup | Aggregates analytics_dataset rows into per-workspace daily counts |
| 0 0 * * 0 | weekly-digest | Sends the weekly digest email to opted-in workspaces |
Note
ultron-cron does not do work itself. Each handler is a thin HTTP POST to the app with a signed body so the actual logic lives where the rest of the platform lives.
Dispatch contract
The body each handler dispatch carries.
dispatch payloadjson
The app verifies the HMAC, idempotency-checks the nonce against a short-lived KV cache, and runs the handler. On failure it returns 5xx; the cron worker retries up to twice with exponential backoff before logging a warning to the analytics dataset.
File map
cf-workers/ultron-cron
wrangler.toml
src
index.tsscheduled() dispatcher + fetch() webhook receiver
dispatch.tssigned POST helper
cf-workers/ultron-cron-scheduler
wrangler.toml
src
index.tsscheduled() reads schedules + dispatches