feat(cron): per-job LLM provider/model override (#1234)

makeCronJobHandler builds the agent RunRequest with no provider/model, so cron
jobs always run on the agent default provider. High-frequency scheduled jobs
(e.g. triage) can't be routed to a cheaper model the way heartbeats already can
via agent_heartbeats.provider_id/model.

Add provider_id/model to cron_jobs (Postgres migration 000074; SQLite schema +
migration v42→43, both mirroring agent_heartbeats) and resolve them into
RunRequest.ProviderOverride/ModelOverride in the handler, reusing the existing
per-run override plumbing that heartbeats use. NULL/unset → agent default, so
existing jobs are unaffected.

Settable today via UpdateJob patch (CronJobPatch.ProviderID/Model) or directly
in the DB; tool/RPC/dashboard exposure left as a follow-up.

Verified: go build ./... and go build -tags sqlite ./... (exit 0), go vet,
gofmt, and cron unit tests on both pg and sqlite stores.
This commit is contained in:
Zezae Oh authored and GitHub committed 2026-06-21 00:19:39 +07:00
1 parent fc308a3989
commit 2bf0f9e172
18 files changed
+151 -22

No files matched your search

+2
View File
@@ -470,6 +470,8 @@ CREATE TABLE IF NOT EXISTS cron_jobs (
deliver_channel TEXT NOT NULL DEFAULT '',
deliver_to TEXT NOT NULL DEFAULT '',
wake_heartbeat INTEGER NOT NULL DEFAULT 0,
provider_id TEXT REFERENCES llm_providers(id) ON DELETE SET NULL,
model VARCHAR(200),
next_run_at TEXT,
last_run_at TEXT,
last_status VARCHAR(20),