feat: add adaptive review effort budgets #19

Merged
masi merged 4 commits from feat/review-budget-governor into main 2026-09-01 12:15:17 +00:00
Showing only changes of commit f9eef969e6 - Show all commits
+11
View File
@@ -150,10 +150,21 @@ rates, calibrated against runs measured through the usage telemetry
(`OBSERVED_RUNS` in that file — append to it, don't guess). Tokens are summed (`OBSERVED_RUNS` in that file — append to it, don't guess). Tokens are summed
from opencode `step_finish` events per review. from opencode `step_finish` events per review.
Each review is governed by hard limits: 20 completed steps, 120,000 total
tokens, 20,000 output tokens, and 480 seconds by default. Limits can be
overridden deployment-wide with `PRAGENT_MAX_REVIEW_STEPS`,
`PRAGENT_MAX_REVIEW_TOKENS`, `PRAGENT_MAX_REVIEW_OUTPUT_TOKENS`, and
`PRAGENT_REVIEW_TIMEOUT`, or per repository in the trusted base-branch
`.pr-review.json`; repository values win.
Two measured reviews of a ~1100-line PR in this repo: 28 and 31 agent steps, Two measured reviews of a ~1100-line PR in this repo: 28 and 31 agent steps,
~2.1M input tokens each, **zero cache reads or writes**. The demo repo's PR, same ~2.1M input tokens each, **zero cache reads or writes**. The demo repo's PR, same
tier: 126K tokens. tier: 126K tokens.
The measurements above are historical uncapped runs. A capped run preserves
completed output, reports the cap reason in the review, and records it in
Langfuse.
| Model | this repo, ~1100-line PR | demo repo PR | | Model | this repo, ~1100-line PR | demo repo PR |
|---|---:|---:| |---|---:|---:|
| Claude Opus 5 | ~$10.79 | ~$0.71 | | Claude Opus 5 | ~$10.79 | ~$0.71 |