Skip to content

The review session API returns the checks the review ran, its model cost, and whether it goes on in parts - #965

Merged
coderhelm[bot] merged 2 commits into
mainfrom
reviewer-session-checks-cost-main
Dec 4, 2026
Merged

coderhelm[bot] merged 2 commits into
mainfrom
reviewer-session-checks-cost-main

Conversation

@nambok

@nambok nambok commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The review session API now returns what its page needs to say what a review checked and what it cost: the checks the review ran on the change (each command, its result and why it didn't pass), the review's model cost, and whether a session is one part of a review read in parts.

Pairs with the dashboard change CoderHelm/coderhelm#539 (already merged; its page treats these fields as missing until this lands). This replaces #961, which was merged into plan-builds-every-repo after #956 had already been squash-merged, so it never reached main. Same change, applied to current main.

Changes

  • common::review_session: the verification run as data (VerificationRecord, one CheckRun per command with passed, failed, couldnt_run or skipped and a reason), the model cost in whole millionths of a dollar (ADD, so every invocation of a job adds to it), and goes_on for a session that read one part of a large pull request. Reads and writes are bounded and tested.
  • common::usage: a SpendTally task-local. Every model call that already counts against a run's allowance also adds to the tally, whatever allowance it runs under, so a review job can read what it spent.
  • Worker: the review dispatch runs each job under a tally. review_verify::judge and Verification::not_run keep the run as data next to the markdown they already wrote. The review records it on its session, records off when the repository's reviews don't run checks, adds its spend before the session closes (and anything spent after, such as a reply), and marks a part that goes on. The last step of such a part now reads "Read this part; the review goes on in its next part: …".
  • Gateway: GET /api/reviewer/session returns verification (SessionVerification with SessionCheck rows), cost_usd and goes_on. Older sessions return null, null and false. docs/api/openapi.json is regenerated.

Verification

  • cargo fmt --all --check, rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs
  • cargo clippy --all-targets -p common -p worker -p gateway -- -D warnings
  • cargo test -p common -p worker -p gateway
  • python3 .github/scripts/brand_spelling.py, python3 .github/scripts/domain_examples.py
  • New tests: the verification record round-trips and is bounded, spend is kept in whole millionths, a part says so, the tally counts spend inside any allowance and nothing outside it, and the session API returns all three (and null on older sessions).

…ost, and whether it goes on in parts

A review's session page could say what was decided but not what was
verified or what it cost. The verification run existed only as markdown
in the review body, and per-review spend wasn't kept anywhere.

- common::review_session keeps the verification run as data (one row per
  command: passed, failed, couldnt_run or skipped, with a reason), the
  model cost in whole millionths of a dollar, and goes_on for a session
  that read one part of a large pull request.
- common::usage gains a SpendTally task-local; every model call adds to
  it, whatever allowance it runs under.
- The review dispatch runs each job under the tally. The worker records the run (or "off" when checks are turned off), adds
  the job's spend before its session closes, and marks a part that goes on.
- GET /api/reviewer/session returns verification, cost_usd and goes_on;
  older sessions return null, null and false. openapi.json regenerated.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 4, 2026
coderhelm[bot]

This comment was marked as outdated.

@coderhelm

coderhelm Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

💚 Post-merge health check passed: the deploy of 3605da3 completed and stayed green for the full 15-minute watch window (no new failures vs. the pre-merge baseline).
Auto-merge

  • ✅ CoderHelm approved
  • ✅ CI green
    The rest is in the pull request description.

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Approved with notes 25e41d8 (merged)

@coderhelm
coderhelm Bot merged commit 3605da3 into main Dec 4, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant