# State-machine study A study of QuickReview's state-machine review on the 34 AACR-Bench pull requests that hold the earlier list of 45 labelled state defects (28 of them hold a state defect under the strict relabel below), with the default review beside it. It holds the two runs' posted comments and judge verdicts, every label the study made, and the earlier builds' found flags on the answer key's state defects, and a preliminary third run, `sm5-a`, the state-machine review with GPT-6.2 Astra as the reviewer (its comments and verdicts; none of its comments is labelled). No config of the card reads this folder, so `load_dataset` returns the same rows with or without it. `bench/aacr/recompute/state_machines.py --data ` recomputes every number below from these tables alone, checks that this README is the one the tables give, and runs the release's other checks of the folder (`validation.json` holds them). The folder backs the write-up's sections on the merged build: the strict relabel, the two runs on all 34 pull requests, the bugs outside the answer key, and the cost of the two runs. It does not back the write-up's earlier tests on the list of 45 (their recall, costs and miss traces), the lookup tool's and the validator's audits, or the self-review of the change that adds the state lenses. ## The runs | Arm | What ran | Inline comments | $ per PR | Minutes per PR | |---|---|---|---|---| | `sm4-p` | the state-machine review: `review.profile=state-machines`, the eight `pass-sm-*` lenses alone, at deep on every change, on public main | 159 | 2.78 | 12.0 | | `sm1-c` | the default review with its automatic state lens off (`state_machines.triggers=off`), on an earlier build from a branch that was never published (`arms.qcr_commit_on_public_main` false) | 397 | 2.77 | 14.0 | | `sm5-a` | preliminary: the state-machine review as `sm4-p`, reviewer `openai-codex/gpt-6.2-astra`, lens pass deadline 20 minutes where the shipped default is 8, on public main plus one bench-only commit that registers the model with pi (`arms.qcr_commit_on_public_main` false) | 448 | 21.06 | 15.1 | Reviewer and judge gpt-6.1-sol, the judge at high effort; one run each. `sm5-a`'s reviewer is gpt-6.2-astra and its judge the same gpt-6.1-sol at high effort. Cost is the list-price equivalent, priced per review as the dataset's `reviews.cost_usd` is (compare.usd_and_minutes: pi's cost of each call at the model's list prices; for gpt-6.2-astra, OpenAI's list prices at its release); the judge's cost is not in it. Every count of comments here is of inline comments; the default review also posted 5 findings in its review body, the state review 0, and `sm5-a` 2. ## Tables Every table is a `.parquet` file in this folder. - `arms`: the three runs: image, config, `profile` (null when the run set none), the build commit as the release states one (`qcr_commit`, `qcr_commit_on_public_main`, `qcr_commit_match`, `qcr_commit_dirty`, see the card's `runs`), pi, models, run directories. - `cases`: one row per arm and pull request: set, run, `status` (the case's run status), the review's `verdict` (`APPROVE`, `COMMENT` or `REQUEST_CHANGES`), cost, minutes, `n_posted` (the inline comments), whether the judge read it, and the judge's token usage. - `reviews`: every finding of the three runs as QuickReview posted it, with the judge's id for it (`comment_id`, C1..Cn). An inline comment has `inline` true, `index` from 0 in posting order, and the `path`, `line`, `side` and `body` it was posted with. A finding posted in the review body instead has `inline` false, `index` null, its `path` and last `line`, and its text as the judge read it. - `defect_verdicts`, `comment_verdicts`: the judge's verdicts, with the dataset's columns of the same names (`judge`, `key_version`, `credit`, ...) except `run_family`, since these runs are not in its `runs` table; `comment_verdicts.index` is the inline comment the judged row is (null for a finding posted in the review body). The answer-key defects themselves are in the dataset's `defects` table, by `instance_id` and `defect_id`. - `state_labels`: all 186 answer-key defects of these pull requests, relabelled blind by two AI readers (a third settled 28 disagreements, `how` `tiebreak`): `verdict` `state_machine`, `borderline` or `not`, by the rule that a state bug needs a named state and an event or sequence, so that a single call with fresh state would behave correctly; `klass`, the kind of state bug; `old45`, whether the defect was on the earlier list of 45; `reachable`, false for a state defect a second reader agreed cannot happen at head; `votes`, each reader's verdict, kind and reason. Where a reason repeated 10 or more words in a row of the defect's own text, those words are replaced by `[words of the answer key's defect]`; the text is in `defects`. - `comment_state_labels`: every inline comment of the state review (159), and every inline comment of the default review that the judge matched to no answer-key defect (224), labelled with the same rule: `title`, the comment's first line; `verdict`, `klass` and `reason`. The state review's non-state calls were read a second time (64 reads, 2 changed): `first_verdict` is the first reader's, `second_read_*` the second read's, and `verdict` the final one. `key_defect` is the answer-key defect the judge matched a state-review comment to (null when none, and for the default review's rows). `real_if_unlisted` is, for a state comment that matches no answer-key defect, whether a reader found the bug real at head (`real` or `unsure`), and `n/a` for every other comment. `sm5-a`'s comments are not labelled. - `pooled_bugs`: the 105 known real state bugs: the 55 reachable strict state defects of the answer key (`source` `answer-key`, `local_id` the defect id) and 50 real state bugs either review posted that the key does not list (`source` `unlisted`, `local_id` U1..; `statement` is ours). An unlisted bug was confirmed in the code at head by an AI reader and re-checked by a sceptical one (`check_reason`); a candidate the check rated unsure at head is left out. The inline comments that raise it are listed by `index` (`state_review_comments`, `default_review_comments`); each one only one review found was checked once more blind to which review posted it (`blind_*`). The answer-key rows' found flags are the judge's verdicts (`found`); the unlisted rows' are the labels, and each is true exactly when its list of comments is not empty. - `misses`: the state review's 12 misses on the strict state defects, each traced through the run's plan, lens transcripts and candidate findings (the trace itself is not here): the `cause`, the lens that owned the defect (`owning_lens`), the lenses the run's plan held (`planned_lenses`), and what would have caught it; `second_read_*` is a second reader's check of the cause where one was made, and `relabel_note` says why a cause was changed on review (null where it was not). - `earlier_arms`: whether each of four earlier builds found each strict state defect (judge verdict `found`); derived flags only, their reviews are not in this folder. `sm5-a`'s found flags are its rows of `defect_verdicts`. - `figures/`: the write-up's four charts (the two runs; `sm5-a` is not drawn). ## The numbers, and how each is recomputed **The strict relabel** (`state_labels`): 56 state, 2 borderline, 128 not, of 186; 55 of the state ones are reachable at head, and 21 of them were not on the earlier list. Of the earlier list of 45 (`old45`): 35 state, 2 borderline, 8 not. **Answer-key recall** on the 55 (`defect_verdicts.verdict` `found`, against the reachable state rows of `state_labels`): the state review 44 (80%), the default review 45 (82%). The state review found 0 the default review did not; the default review found 1 the state review did not (`immich-app__immich@b7a1255#D2`). On the earlier list of 45 the state review found 35 and the default review 36. The earlier builds (`earlier_arms`): | Arm | Build | Found of 55 | |---|---|---| | `sm1-s4` | the state-machine review's first version: four state lenses on every change, the other four on a signal | 38 (69%) | | `sm1-s8` | all eight state lenses on every change, normal effort | 39 (71%) | | `sm1-s8d` | all eight state lenses on every change, higher effort, before the lookup tool | 43 (78%) | | `sm1-r` | the eight state lenses added to the default review, in one run (an earlier build) | 46 (84%) | **The pool** (`pooled_bugs`): 105 known real state bugs, 55 in the answer key and 50 outside it. Found: the state review 89 (85%), the default review 75 (71%), either 95 (90%). Of the unlisted: 25 both, 20 only the state review, 5 only the default review; 25 of the 25 one-sided ones held when re-checked blind. | Class | Pool | State review | Default review | |---|---|---|---| | event-order | 31 | 29 | 22 | | stale-copy | 25 | 18 | 16 | | lifecycle-order | 18 | 17 | 13 | | stored-state | 13 | 8 | 10 | | stuck-state | 8 | 7 | 7 | | unhandled-state | 4 | 4 | 3 | | unchecked-transition | 3 | 3 | 3 | | impossible-states | 3 | 3 | 1 | **Comments** (`reviews` with `inline` true, `comment_state_labels`, `comment_verdicts`): the state review posted 159 (4.7 per PR), 96 state (60%), 31 borderline and 32 not (20%); the judge graded 28 of the 32 not-state ones correct. The default review posted 397 (11.7 per PR), 224 of them matched to no answer-key defect; together 16.4 per PR. Of all 186 answer-key defects, of every kind, the default review found 161 (`found`; 1 more partly) and the state review 92 (0 more partly). A judge's credit for a finding posted in the review body counts: its text is the `reviews` row with `inline` false. **Misses** (`misses`): 12, 11 of them real: 5 where a lens read the site and reported nothing, 6 where it reported a different problem at the site, 1 not real at head. They are exactly the strict state defects the state review did not find. **Cost** (`cases.usd`): 2.78 and 2.77 dollars per PR, rounded to cents as the write-up prints them; both runs together cost 5.56 per PR, the exact sum (5.5566) rounded, not the sum of the two rounded costs. ## Preliminary: GPT-6.2 Astra (`sm5-a`) The state-machine review of `sm4-p` with `openai-codex/gpt-6.2-astra` as the reviewer, on the same 34 pull requests, judged by gpt-6.1-sol at high effort (`defect_verdicts`, `comment_verdicts` with `arm_id` `sm5-a`). On the 55 reachable strict state defects it found 52 (95%); it missed `ClickHouse__ClickHouse@f9d51fa#D2`, `lvgl__lvgl@e526b2a#D12`, `mpv-player__mpv@0729afe#D3`. It found 8 that `sm4-p` did not, and `sm4-p` found 0 that it did not. Of all 186 answer-key defects, of every kind, it found 152 (`found`; 1 more partly). It posted 448 inline comments (13.2 per PR), for 21.06 dollars per PR at list price. It is preliminary: one run; its lens pass deadline was 20 minutes where the shipped default is 8; its judge is not its reviewer's model; none of its comments is labelled, so how many are about state bugs is not known (the state review's comments are not all about state: see the comment labels above); and none of its bugs outside the answer key were pooled, so it has no share of the pool. ## Limits - AI agents made the answer key, the state labels, the comment labels and the checks of the unlisted bugs, and no person has checked them. - The pool counts the state bugs known on these pull requests. A state bug that neither review found and the answer key does not list cannot be counted, so the pooled shares are of the known bugs and overstate true recall. - The answer-key part is scored by the judge; the unlisted part by AI agents reading the code. - One run per arm. A repeat of one earlier build differed by one defect. - The default arm ran with its automatic state lens off, on an earlier build from a branch that was never published; the merge did not change its other lenses. - The judge is the reviewer's model, gpt-6.1-sol, for the two runs; `sm5-a`'s reviewer is another model. - Part of the answer key entered it through the default review's own earlier comments, which favours the default review on the key. - The pull requests were chosen because they hold labelled state defects, so state bugs are more common in them than in ordinary pull requests. - The earlier builds' reviews and costs are not in this folder; their found flags are.