Skip to content

fix: make review call estimates demand-driven - #71

Closed
EmersonBraun wants to merge 1 commit into
mainfrom
codex/adaptive-budget-v0.3.0
Closed

EmersonBraun wants to merge 1 commit into
mainfrom
codex/adaptive-budget-v0.3.0

Conversation

@EmersonBraun

Copy link
Copy Markdown
Member

Summary

  • stop reserving worst-case adversarial verification calls during provider-free planning
  • keep the runtime maxCalls ceiling hard and fail-closed
  • update tests and public operational documentation

Validation

  • npm run check
  • npm pack --dry-run

Package version: 0.3.0; intended release tag: v0.3.0.

@EmersonBraun EmersonBraun left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — COMMENT

1 finding(s) (1 med) across 8 file(s). 8/8 lens executions succeeded.

const perFile = Math.max(1, (batched ? 1 : enabledLenses.length) * (1 + retries) + (maxFindingsPerFile ?? enabledLenses.length) * auditVotes * (1 + retries))
const perFile = Math.max(1, (batched ? 1 : enabledLenses.length) * (1 + retries))
plan.overBudget.push(`${estimatedProviderCalls} estimated provider calls exceed maxCalls ${maxCalls}`)
plan.suggestions.push(`reduce scope to at most ${Math.max(1, Math.floor((maxCalls - 1) / perFile))} files or lower --votes`)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 med · correctness — Preflight recommendation cannot reduce the estimate it is based on

Why this needs correction
estimatedProviderCalls only includes primary calls and a consolidation reserve, not skeptic votes. Consequently, suggesting --votes as a remedy is ineffective: changing votes does not change the condition at line 713, so the same preflight rejection remains.

Required change
Remove or lower --votes from this recommendation, or include a bounded vote allowance in the estimate if votes are intended to affect preflight.

Acceptance check
Verify the changed behavior prevents this condition and preserves the intended flow.

Review evidence
Verified finding · confidence 0.94

plan.suggestions.push(`reduce scope to at most ${Math.max(1, Math.floor((maxCalls - 1) / perFile))} files`)

@EmersonBraun

Copy link
Copy Markdown
Member Author

AgentsKit review · COMMENT

1 finding(s) (1 med) across 8 file(s). 8/8 lens executions succeeded.

Result: 🟡 1 med · 8/8 lens executions

Actionable findings are attached inline to the relevant changed lines. 1 candidate finding(s) were rejected during verification or thresholding.

Review evidence
  • Profile: fast
  • Provider calls: 10 (failed: 0, skipped: 0)
  • Elapsed: 108272ms · Circuit: closed

@EmersonBraun

Copy link
Copy Markdown
Member Author

Closing without merge: this PR is now CONFLICTING against main, and diffing it shows the change was already absorbed — agents/code-review/agent.ts on main already has the exact demand-driven estimate logic and comment this PR introduces ("Verification is demand-driven: reserve only the optional consolidation call here..."), along with providerCallEstimate: 'best-effort'. No further action needed on this branch.

@EmersonBraun
EmersonBraun deleted the codex/adaptive-budget-v0.3.0 branch September 13, 2026 00:29
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