mirror of
https://github.com/BradGroux/veritas-kanban.git
synced 2026-12-03 19:27:18 +00:00
112 lines
9.4 KiB
Markdown
112 lines
9.4 KiB
Markdown
# Recurring Work Scheduler
|
|
|
|
The recurring work scheduler gives operators one place to inspect and control scheduled Veritas work.
|
|
|
|
It currently surfaces:
|
|
|
|
- scheduled deliverables, including operations digest deliverables
|
|
- workflow definitions with enabled non-manual schedules
|
|
- workflow scheduled-snapshot outputs
|
|
- queue intake monitors
|
|
- immutable, operator-approved automation versions
|
|
|
|
## Operator Controls
|
|
|
|
The scheduler is available in `Settings -> Scheduler`, through `vk scheduler`, and through `/api/scheduler`.
|
|
|
|
Settings also includes an automation-draft compiler. It turns recurring-work intent plus optional structured hints into an immutable `automation-draft/v1` preview. Previewing or saving a draft never creates a scheduler item, reservation, run, provider queue, approval, credential lease, or external action.
|
|
|
|
Each scheduler item exposes:
|
|
|
|
- health: `healthy`, `warning`, `paused`, or `blocked`
|
|
- next and last run timestamps
|
|
- retry attempts and next retry time
|
|
- recent scheduler events
|
|
- manual run, pause, resume, and validate actions
|
|
|
|
Queue monitors appear as `queue-monitor:<monitorId>` items. They use the monitor interval and execute through the queue monitor service, so Run Due can scan GitHub queues without bypassing monitor policy gates.
|
|
|
|
## Execution Model
|
|
|
|
Scheduled deliverables run through the existing scheduled deliverables runner. Workflow schedules run through the existing workflow run service and create a normal workflow run record. Queue monitors run through the policy-gated queue monitor service and record their own candidate packet before the scheduler records the recurring event.
|
|
|
|
The due-runner refuses overlapping scheduler passes and refuses overlapping item runs in the same server process. Failed scheduler runs record retry state with exponential backoff up to the configured retry limit. Scheduler executions also emit bounded run telemetry with `agent=scheduler` and `project=operations`, so operations digests can include scheduler activity.
|
|
|
|
## Custom Cron
|
|
|
|
Custom cron schedules are visible, manually runnable, and validated for a cron expression, but automatic cron due execution is intentionally not enabled in this first pass. Standard `daily`, `weekly`, `biweekly`, and `monthly` schedules have deterministic due calculation without adding a new production dependency.
|
|
|
|
## Automation Drafts
|
|
|
|
The compiler recognizes exact daily, weekday, named-weekday, and bounded minute-interval language. It also accepts a five-field cron expression. Every preview shows its IANA timezone and three representative future UTC timestamps; the calculation preserves the requested local wall-clock time across daylight-saving changes.
|
|
|
|
Consequential values are never silently defaulted. Each field records its value, origin, confidence, status, and explanation. Missing or conflicting schedule, execution target, provider, expiry, overlap policy, retry posture, output, scope, budget, integration, or stop-condition data remains a validation blocker.
|
|
|
|
The standing-scope object separately lists reads, writes, sends, external targets, artifact destinations, integration and credential definition IDs, tools, and approval-required actions. Draft serialization removes URL credentials, query strings, fragments, and common inline secret assignments. Only safe integration identifiers are persisted; raw integration configuration and credential values are not accepted.
|
|
|
|
Saved revisions remain inactive and immutable. Revision, clone, and delete operations touch only the bounded `drafts` collection in scheduler state.
|
|
|
|
## Automation Activation
|
|
|
|
Activation is a separate exact-approval workflow. `automation-activation-preview/v1` binds the selected draft digest and revision to the current workflow version, provider support, tool and integration evidence, output destination, standing scope, per-run and aggregate budgets, expiry, and stop conditions. The returned `requestRevision` is a compare-and-set token. Any target or evidence change produces a different revision and invalidates the pending decision.
|
|
|
|
The first activate call creates a critical Run Approval and returns `202`. After a freshly authenticated human approves that exact action in Run Approvals, retry the identical activation with its approval ID. Veritas then atomically creates an immutable `automation-version/v1` and mutable `automation-binding/v1`. Editing a draft never mutates an active version.
|
|
|
|
Each due or manual execution first persists one `automation-run-claim/v1` for the exact version and due window. Duplicate ticks return the existing claim and do not dispatch again. Accepted runs enter the normal workflow admission controller with a stable automation idempotency key and an execution-tree root anchored to the immutable version. The saved tool scope is intersected with current workflow policy, and the normal launch, phase, provider, credential, approval, and admission controls may narrow or block it.
|
|
|
|
Pause, revoke, expiry, workflow or integration drift, exhausted aggregate runs/cost/tokens/duration, and repeated launch failures stop future acceptance while preserving versions, claims, and scheduler events. A consequential action listed as approval-required still uses a per-run exact-action approval; it never widens the saved standing scope.
|
|
|
|
## CLI
|
|
|
|
```bash
|
|
vk scheduler list
|
|
vk scheduler run-due
|
|
vk scheduler run "scheduled-deliverable:del_ops"
|
|
vk scheduler run "queue-monitor:veritas-backlog-high-priority"
|
|
vk scheduler pause "workflow:weekly-snapshot"
|
|
vk scheduler resume "workflow:weekly-snapshot"
|
|
vk scheduler validate "workflow:weekly-snapshot"
|
|
vk scheduler draft preview --intent "Every weekday at 9 AM create a support report" --request-id draft-preview --hints '{"timezone":"America/Chicago"}' --json
|
|
vk scheduler draft save --intent "Every weekday at 9 AM create a support report" --request-id draft-save --hints '{"timezone":"America/Chicago"}' --json
|
|
vk scheduler draft list --json
|
|
vk scheduler draft show automation_ID --json
|
|
vk scheduler draft revise automation_ID --intent "Every weekday at 8 AM create a support report" --request-id draft-revise --hints '{"timezone":"America/Chicago"}' --json
|
|
vk scheduler draft clone automation_ID --request-id draft-clone --json
|
|
vk scheduler draft delete automation_ID --confirm automation_ID --json
|
|
vk scheduler draft activation-preview automation_ID --request-id activation-1 --revision 2 --json
|
|
vk scheduler draft activate automation_ID --request-id activation-1 --expected-request-revision sha256:DIGEST --revision 2 --json
|
|
vk scheduler draft activate automation_ID --request-id activation-1 --expected-request-revision sha256:DIGEST --revision 2 --approval-id runapproval_ID --json
|
|
vk scheduler automation list --json
|
|
vk scheduler automation pause automation_binding_ID --expected-revision 1 --reason "Maintenance window"
|
|
vk scheduler automation resume automation_binding_ID --expected-revision 2 --reason "Maintenance complete"
|
|
vk scheduler automation revoke automation_binding_ID --expected-revision 3 --reason "No longer authorized"
|
|
```
|
|
|
|
Use `--json` on any command for automation-friendly output.
|
|
|
|
## API
|
|
|
|
Mounted at `/api/scheduler`.
|
|
|
|
| Method | Path | Description |
|
|
| -------- | ---------------------------------------------- | ---------------------------------------------- |
|
|
| `GET` | `/api/scheduler` | List scheduler items and events |
|
|
| `GET` | `/api/scheduler/items/:id` | Read one scheduler item |
|
|
| `POST` | `/api/scheduler/items/:id/run` | Run one scheduler item now |
|
|
| `POST` | `/api/scheduler/items/:id/pause` | Pause one scheduler item |
|
|
| `POST` | `/api/scheduler/items/:id/resume` | Resume one scheduler item |
|
|
| `POST` | `/api/scheduler/items/:id/validate` | Validate one scheduler item |
|
|
| `POST` | `/api/scheduler/due/run` | Run all items due now |
|
|
| `POST` | `/api/scheduler/drafts/preview` | Compile without saving |
|
|
| `GET` | `/api/scheduler/drafts` | List latest inactive revisions |
|
|
| `POST` | `/api/scheduler/drafts` | Save an inactive draft |
|
|
| `GET` | `/api/scheduler/drafts/:id` | Read a draft revision |
|
|
| `POST` | `/api/scheduler/drafts/:id/revisions` | Append an immutable revision |
|
|
| `POST` | `/api/scheduler/drafts/:id/clone` | Clone as another inactive draft |
|
|
| `DELETE` | `/api/scheduler/drafts/:id` | Delete all inactive revisions |
|
|
| `POST` | `/api/scheduler/drafts/:id/activation-preview` | Preview exact standing authority |
|
|
| `POST` | `/api/scheduler/drafts/:id/activate` | Request approval or activate the exact version |
|
|
| `GET` | `/api/scheduler/automations` | List versions, bindings, and recent claims |
|
|
| `POST` | `/api/scheduler/automations/:bindingId/pause` | Pause with compare-and-set |
|
|
| `POST` | `/api/scheduler/automations/:bindingId/resume` | Resume with compare-and-set |
|
|
| `POST` | `/api/scheduler/automations/:bindingId/revoke` | Permanently revoke with compare-and-set |
|