-
Notifications
You must be signed in to change notification settings - Fork 0
Control Plane Scheduling
A scheduling-policy layer over the v0.1.28 Run Registry queue: priority + a hard concurrency ceiling + lease lifecycle + retry/backoff + a fail-closed park state. Policy-as-data, deterministic, in a distinct
schednamespace. Shipped in v0.1.37. Repo doc:docs/control-plane-scheduling.7.md.
The v0.1.28 queue had ORDER (priority, enqueuedAt) but no policy — nothing
limited in-flight runs, nothing retried with backoff, and queue drain would
re-hand the same failing entry forever. v0.1.37 layers policy over the existing
queue (no queue file duplicated). The sched namespace is separate from the
unrelated wall-clock schedule (loop/cron) scheduler.
The queue has order; this adds policy.
Concurrency is a hard ceiling — never exceeded.
Past the budget: park, not retry-forever.
Deterministic: inject now, no jitter.
SchedulingPolicy is a plain, diffable file ($CW_HOME/registry/ scheduling-policy.json) with conservative fail-closed defaults (maxConcurrent 1,
maxAttempts 3, leaseTtlMs 300000, exponential backoff capped at 60s, no
jitter). The core (src/scheduling.ts) is pure — every function takes an injected
now, reuses compareQueue, and operates on the existing RunQueueEntry[]. "CW
records readiness/order/leases; the host still executes the workers."
ready --lease--> leased --complete--> drained
^ | \--release(failed)/expire--> ready (+backoff) | parked
|__reset________/
-
sched plan— READ-ONLY would-be lease plan for queue+policy+now; deterministic, replayable, payload-identical across CLI/MCP. -
Hard concurrency ceiling (load-bearing fail-closed) —
maxConcurrentbounds in-flight (leased) entries; leasing stops at the ceiling, over-limit entries stayready. Never exceeded. -
Leases —
sched leaseclaims eligible entries (priority order) with aleaseId+leaseExpiresAt;sched completeis terminal success; an EXPIRED lease (sched reclaim) is reclaimable and counts one recorded failed attempt. -
Retry with computed backoff — a failed/expired attempt under budget
increments
attemptsand setsnextEligibleAt = now + baseMs*factor^(attempts-1)(capped); deterministic, no randomness. -
Park past budget (fail closed) — at
maxAttemptsthe entry becomesparkedand is NEVER re-selected;sched resetis the only way back. The queue can never re-hand a failing entry forever. -
Backward compatible —
RunQueueEntryadditively gains scheduling fields +leased/parkedstatuses; a pre-0.1.37queue.jsonloads unchanged; thequeue add|list|drain|showverbs are untouched.
This makes the durable queue safe to actually drain at scale: concurrency is
bounded, transient failures retry with backoff, and a persistently failing entry
parks for an operator instead of looping forever — all as inspectable, deterministic
policy data. Verified live via the CLI over a temp CW_HOME, including pre-v0.1.37
queue compatibility.
- Run Registry Control Plane
- Architecture Principles
- CLI MCP Parity
- Repo doc:
plugins/cool-workflow/docs/control-plane-scheduling.7.md
Organized from local Obsidian notes and reconciled with the current
coo1white/cool-workflow repository state.
Start here
Go deeper
- Workflow Apps
- Architecture
- Trust And Audit
- Recovery And Restore
- Commands or API
- MCP And Manifests
- Operations
- FAQ
Source docs