Skip to content

feat(reviewer): budget/cooldown-aware review — defer, don't burn (audit D1 pt1) - #462

Merged
ProtocolWarden merged 1 commit into
mainfrom
feat/reviewer-budget-aware-park
Jul 14, 2026
Merged

feat(reviewer): budget/cooldown-aware review — defer, don't burn (audit D1 pt1)#462
ProtocolWarden merged 1 commit into
mainfrom
feat/reviewer-budget-aware-park

Conversation

@ProtocolWarden

Copy link
Copy Markdown
Owner

Audit D1, part 1. The reviewer is part of the fleet but was claude-only and consulted no budget — so it burned claude reviewing PRs even when the account was over the 25% reserve. This was observed live tonight: the reviewer reviewing my own audit PRs during a budget crunch pushed the account toward the hard session_5h limit.

Fix: before the direct claude -p verdict call, _process_self_review now calls _select_review_backend, which reuses the controller's select_worker_backend ladder. If claude is cooled or over the budget reserve (selected_backend != "claude_code"), the reviewer defers the sweep — no claude spawn, no budget charge, no needs-human escalation — and retries when the window drains (~5h). Degrade-never-halt, applied to review.

Safety:

  • Fail-open: any selection/store error → proceed on claude (today's behavior). The merge-gatekeeper never crashes on a store read.
  • Honors dynamic_worker_backend_selection=False (operator's global opt-out) → always the preferred backend.
  • Verdict parsing is untouched (already backend-agnostic, file-based verdict.json).

Scope: this is part 1 — stop the over-budget burn and defer smart. Part 2 will actually review on codex when claude is cooled (needs live validation that codex writes a schema-conformant verdict.json in the empty-dir/-p contract — the one unknown from scoping). Until then, a non-claude selection means claude (the only review backend) is unavailable → defer.

Tests: 3 new (_select_review_backend: available / defers-when-cooled / respects-dynamic-off) + all 150 existing reviewer tests green; ruff + ty clean; custodian audit clean.

🤖 Generated with Claude Code

…it D1 pt1)

The reviewer is part of the fleet but was claude-only and consulted no budget,
burning claude even over the 25% reserve. Now it calls select_worker_backend
(the controller's ladder) before the direct verdict call: if claude is cooled
or over the budget reserve, it DEFERS the sweep (no claude spawn, no budget
charge, no escalation) and retries when the window drains. Fail-open to claude
on any selection error; honors dynamic_worker_backend_selection=False. Verdict
parsing untouched. Part 1 of D1; part 2 adds codex review (needs validation).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ProtocolWarden
ProtocolWarden merged commit 913f8af into main Jul 14, 2026
25 checks passed
@ProtocolWarden
ProtocolWarden deleted the feat/reviewer-budget-aware-park branch July 14, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant