feat(reviewer): budget/cooldown-aware review — defer, don't burn (audit D1 pt1) - #462
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_5hlimit.Fix: before the direct
claude -pverdict call,_process_self_reviewnow calls_select_review_backend, which reuses the controller'sselect_worker_backendladder. 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:
dynamic_worker_backend_selection=False(operator's global opt-out) → always the preferred backend.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.jsonin the empty-dir/-pcontract — 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