Add atomic task status transitions (compare-and-swap claim)

t-587.5·WorkTask·
·
·
·Omni/Task.hs
Parent:t-587·Created1 week ago·Updated1 week ago

Description

Edit

Add atomic task status transitions to prevent race conditions between loops.

Problem: Three independent loops poll and mutate the same task database. A dev loop could promote a task to review while the reviewer is already mid-check, or an integrator could pick up a task that was just rejected.

Implement: 1. Add a task claim <id> <expected-status> <new-status> CLI command that atomically transitions status only if current status matches expected. Returns success/failure. Example: task claim t-575 open in-progress succeeds only if status is currently open. 2. Use this in run_single_task and select_next_task:

  • Dev: claim open → in-progress before running
  • Review: claim review → review-in-progress (or similar) before running
  • Integrator: claim approved → integrating before running

3. If claim fails (status already changed), skip and move to next task. 4. This is a compare-and-swap pattern. Implement in Omni/Task/Core.hs with a SQL WHERE clause on current status.

Files: Omni/Task.hs, Omni/Task/Core.hs, Omni/Ide/dev-review-release.sh

Timeline (26)

🔄[human]Open → InProgress1 week ago
💬[human]1 week ago

Automation (dev) patchset 0 attempt 1/5 failed for run dev-t-587.5-20260211-181719.

💬[human]1 week ago

Automation (dev) patchset 0 attempt 2/5 failed for run dev-t-587.5-20260211-182314.

💬[human]1 week ago

Automation (dev) patchset 0 attempt 3/5 failed for run dev-t-587.5-20260211-182413.

💬[human]1 week ago

Automation (dev) patchset 0 attempt 4/5 failed for run dev-t-587.5-20260211-183622.

💬[human]1 week ago

Implemented atomic status claims for loop race protection in commit 8f4313d6. Added task claim command + Core claimTask CAS update, wired dev/review/integrator selection to claim transitions (open->in-progress, review->review-in-progress, approved->integrating), and added failure rollback of claimed review/integrating statuses. Extended status parsing for review-in-progress/integrating.

🔄[human]InProgress → Review1 week ago
🔄[system]Review → ReviewInProgress1 week ago
💬[human]1 week ago

Automation (review) patchset 1 attempt 1/5 failed for run review-t-587.5-20260211-184416.

🔄[human]ReviewInProgress → Review1 week ago
💬[human]1 week ago

Manual review due agent budget exhaustion in review loop. Verified: (1) claim command works with correct exit semantics (success=0, failure=1) via live test task t-592, (2) typecheck.sh Omni/Task.hs passes, (3) bild Omni/Task.hs passes, (4) lint passes for Omni/Task.hs, Omni/Task/Core.hs, Omni/Ide/dev-review-release.sh. Reviewed diff on commit 8f4313d6 for CAS SQL update + loop claim wiring.

🔄[human]Review → Approved1 week ago
🔄[system]Approved → Integrating1 week ago
💬[human]1 week ago

Automation (integrator) patchset 1 attempt 1/5 failed for run integrator-t-587.5-20260211-184503.

🔄[human]Integrating → Approved1 week ago
💬[human]1 week ago

Integrator loop could not run to completion due provider budget exhaustion (CostExhausted) for run integrator-t-587.5-20260211-184503. Manually integrated commit 8f4313d6 onto live via integrator worktree as commit 24a7fdb4 after successful local verification (typecheck/lint/bild for Omni/Task.hs + claim command runtime test).

🔄[human]Approved → Done1 week ago