Repository navigation
The review session API returns the checks the review ran, its model cost, and whether it goes on in parts - #961
Conversation
…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.
|
|
||
| /// Dollars the current tally counted since this was last asked, and zero | ||
| /// outside one: a review job adds it to its session as it ends. | ||
| pub fn take_spend_tally() -> f64 { |
There was a problem hiding this comment.
💬 FYI: A parallel structure next to an existing one (scope, not verified)
services/common/src/usage.rs adds take_spend_tally next to the existing take_run_spend. Extend the existing one (add the entries or the parameter there) and remove the new one. If the ticket truly needs it, say why on a line Wider than the ticket: services/common/src/usage.rs: <why>.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| pub const GOES_ON: &str = "goes_on"; | ||
|
|
||
| /// Mark `job`'s session as one part of a review that goes on in its next job. | ||
| pub async fn note_goes_on(dynamo: &DynamoClient, table: &str, team_id: &str, job: &str) { |
There was a problem hiding this comment.
💬 FYI: Near-identical helpers added together (scope, not verified)
services/common/src/review_session.rs adds note_goes_on next to note_verification, added in the same change. Keep one helper with the shared logic (a parameter for what differs) and call it from both places. If the ticket truly needs it, say why on a line Wider than the ticket: services/common/src/review_session.rs: <why>.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
|
Auto-merge
|
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. Based on #956 (
plan-builds-every-repo), because the dashboard's API field list already names #956's fields; GitHub moves this ontomainwhen #956 merges.Changes
common::review_session: the verification run as data (VerificationRecord, oneCheckRunper command withpassed,failed,couldnt_runorskippedand a reason), the model cost in whole millionths of a dollar (ADD, so every invocation of a job adds to it), andgoes_onfor a session that read one part of a large pull request. Reads and writes are bounded and tested.common::usage: aSpendTallytask-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.review_verify::judgeandVerification::not_runkeep the run as data next to the markdown they already wrote. The review records it on its session, recordsoffwhen 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: …".GET /api/reviewer/sessionreturnsverification(SessionVerificationwithSessionCheckrows),cost_usdandgoes_on. Older sessions returnnull,nullandfalse.docs/api/openapi.jsonis regenerated.Verification
cargo fmt --all --check,rustfmt --check --edition 2021 worker/src/passes/incidents/*.rscargo clippy --all-targets -p common -p worker -p gateway -- -D warningscargo test -p common -p worker -p gatewaypython3 .github/scripts/brand_spelling.py,python3 .github/scripts/domain_examples.pynullon older sessions).