Implement ACTIVITY-WP-0026 ops_run claim queue (T01–T06).
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
Build and Publish Container Image / build-and-push (push) Successful in 52s

Add durable claimable ops_runs table, emit dual-write on TaskSpec, REST
claim/lease/complete/fail API, ops status visibility, and consumer docs
aligned with ACT-ADR-005. T07 railiance rollout remains deploy-side.
This commit is contained in:
tegwick 2026-08-03 19:22:50 +02:00
parent a145cc4027
commit 15eb3a2066
15 changed files with 1294 additions and 27 deletions

View file

@ -396,6 +396,43 @@ Default: **`ISSUE_SINK_TYPE=state-hub`** (ACTIVITY-WP-0022). See
`review_required` on instructions is **metadata only** until a downstream
review queue exists (issue-core / work-record lane) — see ACTIVITY-WP-0023-T09.
## Ops run claim queue (ACTIVITY-WP-0026)
Durable claimable instances for scheduled automation. Spec:
`docs/ops-run-queue.md`. Architecture: ACT-ADR-005.
```bash
# Visibility (counts + stuck SLA in status)
curl -sS "http://localhost:8010/ops/automations/status?since=today" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('ops_runs'))"
# Open runs
curl -sS "http://localhost:8010/ops-runs?state=open" | python3 -m json.tool
# Claim (worker)
curl -sS -X POST "http://localhost:8010/ops-runs/claim" \
-H "Content-Type: application/json" \
-H "X-Worker-Token: $ACTIVITY_CORE_WORKER_TOKEN" \
-d '{"worker_id":"rein-aharness@railiance01","labels":["automated"],"limit":1}'
# Reopen stale leases
curl -sS -X POST "http://localhost:8010/ops-runs/expire-leases" \
-H "X-Worker-Token: $ACTIVITY_CORE_WORKER_TOKEN"
```
| Env | Default | Meaning |
| --- | --- | --- |
| `OPS_RUN_QUEUE_ENABLED` | `true` | Insert ops_run on emit |
| `OPS_RUN_LEASE_SECONDS` | `900` | Claim lease |
| `OPS_RUN_MAX_ATTEMPTS` | `3` | Fail permanently after N claims |
| `OPS_RUN_SLA_HOURS` | `1` | Stuck threshold in status |
| `ACTIVITY_CORE_WORKER_TOKEN` | unset | Harness claim auth |
**Railiance rollout (T07):** apply migration `0007`, set
`OPS_RUN_QUEUE_ENABLED=true` on worker/api, smoke-trigger FI definition, confirm
open row via `GET /ops-runs?state=open`. Keep host timers until REIN-A-0002 claim
loop is proven.
Example distinction from the June 2026 daily triage evidence:
```text