turn run-once: quota_spend CAS failure leaves turn permanently in_progress (completed work unauditable)
Environment
- loopx v1.2.4 (also verified unchanged in v1.3.1 source), Windows, dsh v0.2.0-rc.2 host
- Multi-agent research goal, turn journals fully recorded
What happened (from the run journal, timestamps in UTC)
One agent's turn completed all four substantive phases (host_execute → typed_result → validation → durable_writeback — deliverable written and validated, consumed by downstream agents), then the quota_spend phase CLI exited 1:
2026-10-07T11:57:18Z turn run-once --goal-id adaptive-research --agent-id researcher-3 ...
returncode: 1
stdout_tail: { ... "reason": "resolve_prepared_effect" ... "resume_turn_key": "sha256:6cc2627e..." }
error: "quota run index compare-and-swap precondition failed"
The journal record for that turn shows recovery_decision: continue, resume_from: quota_spend — but nothing ever resumed it (host_attempt_count stayed 1). Result:
statusremainsin_progressforeverreceipt/lineageare never written (null)- The turn is invisible to any attempt-counting/audit logic that keys on lineage.agent_id
So the work was done and validated, but the ledger says it never finished. We only caught it because our settlement step cross-checks a second source and flagged a divergence.
Impact
- Completed, validated work becomes unauditable — silent ledger gap.
recovery_decision: continueappears to be advisory only; no executor picks it up.
Suggestions (directions)
- Retry/recovery path for quota CAS failures (bounded retries at minimum).
- Or make
resume_fromactionable: document who/what is expected to act on it, or auto-resume on next run-once invocation. - If neither, at least mark the turn with a distinct
finalization_failedstatus rather than leavingin_progress.
Happy to share the full journal file and cli-failures log. The turn journal model itself is excellent — this is about closing the last-mile write.
I will trace the quota run-index CAS rejection through Turn settlement and add an auditable failed-settlement result that preserves the completed host/writeback receipts. I will cover definitive rejection separately from ambiguous provider outcomes, and verify that retrying with a fresh quota basis cannot repeat an already committed spend or terminal closeout.
Thanks for picking this up. The failing run's turn journal is available if it helps the trace — it shows the quota CAS rejection mid-run with host/writeback receipts already committed, and the turn remaining in_progress after drain (the material we cited in the issue). Happy to paste the exact receipt lines or a minimal repro script here if useful.
@Dante-dan are you still working on this? I couldn't find a linked PR or branch since your note on 2026-10-07.
If you've moved on, I'm happy to take it. I'd start from your plan: make a definitive quota run-index CAS rejection an auditable failed-settlement result that keeps the completed host/writeback receipts. Ambiguous provider outcomes would be handled separately, and I'd verify that a retry with a fresh quota basis can't repeat a spend or terminal closeout that already committed.
If you're still on it or have work in progress, just say so and I'll stay off it.