Cost guards

Everything that stops Mainark spending money it should not. Each one fails closed: a missing or malformed setting refuses, never falls back to "no limit".

GuardSettingWhat it stops
Auto-dispatch offMAINARK_COORDINATE_AUTO_DISPATCH=0Nothing starts unless dispatched by hand, by issue id.
Opt-in per issueissues.auto_dispatchEven with auto-dispatch on, the sweep only starts issues from a plan submitted with "autoDispatch": true, and after the user confirms it in Cursor. The existing backlog is never swept.
Inbox limitsdocs/setup/plan-inbox.sqlA plan has at most 10 steps. Submitting needs the inbox secret. The inbox holds at most 20 pending plans. An inbox row is imported once, even if the write-back fails.
One run at a timeMAINARK_MAX_INFLIGHT=1The sweep never starts a second implement run.
Daily capMAINARK_DAILY_BUDGET_USDNo paid run (implement or fix) starts once today's recorded spend (UTC) reaches the cap. Implement is refused before the claim (issue stays todo); a fix is refused before the agent is created (the loop ends "needs a human"); the sweep stops at once. Unset = no cap; a typo refuses.
Review round capMAINARK_COORDINATE_AUTO_REVIEW_MAX_ROUNDSAt most N paid fix rounds per PR. The loop always ends on a review-only check, never on an unchecked fix (#86).
Fixes only for MUST FIXMAINARK_CLOUD_FIX_SHOULD_FIX unsetA PASS with only suggestions never starts a paid fix. Missing tests still do.
No repeat on the same head.reviews/pr-N.cloud-fix.jsonA fix that pushed nothing, timed out, or could not be verified blocks a second paid fix against the same head.
Per-call budget--max-budget-usd in the review scriptsCaps a single Claude review call. Budget exhaustion is never retried.
Undelivered machine runMAINARK_MACHINE_HEALTH_URL, MAINARK_MACHINE_CLAIM_TIMEOUT_SA job the self-hosted worker never picks up is cancelled instead of waiting ~15 min.
Daily timer parkedmainark-daily.timer.parked on the boxThe once-a-day dispatch cannot be enabled by accident.

What the cap counts

agent_runs.cost_usd for runs that started today (UTC): implement runs and, since #87, fix runs. Reviews run on the Claude subscription and record $0. A run still in flight has no cost yet, so the cap can be overshot by at most the cost of the runs in flight — one run with MAINARK_MAX_INFLIGHT=1.