diff --git a/AGENTS.md b/AGENTS.md
index 09509033..65f06dc7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -21,10 +21,10 @@ Do not edit `CONTRIBUTING.md`, `assets/CONTEXT.md`, `assets/AGENTS.md`, or
shims, or cleanup of what earlier versions wrote.
- Starting or spawning quests stops at PR creation. It merges only on a
/quest-merge pick: the user's, the one /quest-plan's interview gives its own
- PR, or the standing one /quest-run gives a PR with no user-facing behavior
- change that adds or expands no quests, or a trivial PR such as a dependency
- bump once Pullfrog approves its head; and only after repository checks and
- reviews pass.
+ PR, or the standing one /quest-run gives a low-risk PR in a class
+ `RISK.md` lists under `## Automatic` that adds or expands no quests, or a
+ trivial PR such as a dependency bump once Pullfrog approves its head; and
+ only after repository checks and reviews pass.
- A change to the reviewers in `src/cli/models.ts`, the review prompts in
`src/cli/review.ts`, or a `REVIEW.md` runs `quest eval run` with the base's
build and the head's, and puts both scores and their cost in its PR's
diff --git a/README.md b/README.md
index 1622fbf8..9fe817f5 100644
--- a/README.md
+++ b/README.md
@@ -550,6 +550,7 @@ merge-state dirty
review-decision -
review-record diff-identical 5f1c2e9a8b7d6c5e4f3a2b1c0d9e8f7a6b5c4d3e
risk medium diff-identical low It changes when quest gate admits a command.
+class -
auto-merge -
merge-queue -
landing-stopped -
@@ -569,6 +570,7 @@ comes last, and a missing value prints as `-`:
| `mergeable`, `merge-state`, `review-decision` | GitHub's values, lowercased. |
| `review-record` | Whether the PR body's [`## Review` record](#review-locally) still covers the head, and the head it names last: `current` when it is the head, `diff-identical` when `git diff ...
` prints the same as for it, `stale` otherwise, or `unknown` when GitHub cannot compare them, such as a diff too large; `-` when the record names no full SHA. Whose record counts is the reader's call. |
| `risk` | The record's [risk tier](#risk-tiers), `low`, `medium`, or `high`; the same state as `review-record` for the head it names; the tier its classifier set before any reviewer raised it; and the reason. `-` when the record names none. |
+| `class` | The `## Automatic` class of the base's `RISK.md` the record's classifier found the change in, or `-`. |
| `auto-merge` | Method, who enabled it, when, and the head it was enabled on. |
| `merge-queue` | Queue state, position, and when it was enqueued. |
| `landing-stopped` | The reason the latest merge-queue entry, auto-merge, or [`quest land`](#the-watchers-own-queue) queue entry ended (such as `merge_conflict`, `failed_checks`, `manual`, `manually_disabled`, or `merged`), who ended it, and when; `-` once the PR has entered the merge queue or auto-merge again since. |
@@ -1697,36 +1699,58 @@ own retries, which also counts as the limit there.
Each head also gets a risk tier, `low`, `medium`, or `high`: what could break,
for whom, and how hard it is to undo, set from the change and never from who
-wrote it. Nothing acts on the tier yet; `quest status` and `quest usage` report
-it.
+wrote it. The tier scales the PR's guardrails:
+
+| Tier | Local review | CI | Lands on |
+|---|---|---|---|
+| Low | None; the online reviewer only | The checks its diff reaches | Its own, once its class is in `RISK.md`'s `## Automatic` list; else the maintainer's pick |
+| Medium | The size's pick | The checks its diff reaches | The maintainer's pick |
+| High | The size's pick and a second reviewer on another model | The full suite [`quest suite`](#run-the-full-suite) names | The maintainer's pick, with the full brief |
+
+`/quest-run` carries the picks.
A change is `high`, with no model, when a changed path on either side of a
rename matches a pattern held high: `RISK.md` itself, everything under
`.github/workflows/` and `.github/actions/`, and each pattern in the `## High`
list of the base's `RISK.md`, at the repository's root:
-```markdown
+````markdown
# Risk
Customers run the relay and the player; the CLI is for contributors.
+## Automatic
+
+- `tests` - only tests and their fixtures change
+
## High
- `src/billing/` - charges customers, and refunds are manual
- `**/*.proto` - peers on older releases read the wire format
+
+## Full suite
+
+```sh
+just gate --all
```
+````
Each item is a backticked path from the root, where `*` and `?` stay within one
segment, a whole `**` segment spans any number, and a matched directory covers
everything under it, then ` - ` and why changing it is high. The rest of the
-file is prose for the classifier, such as what is customer-facing. `quest
+file is prose for the classifier, such as what is customer-facing, except
+`## Automatic`, whose items are each a backticked class name of lowercase
+words joined by hyphens, ` - `, and the rule over the diff a change meets to
+fall in it, and `## Full suite`, one fenced block holding the command that
+runs the whole test suite. Each section appears at most once. `quest
review` reads the file from the base's tip, so a change cannot lower its own
tier, and fails on one it cannot read, which the repository's own `quest check`
reports first. A base with no `RISK.md` makes every change no path holds high
`medium`.
Otherwise a classifier reads the diff and the base's `RISK.md` in one read-only
-turn and replies with a tier and one sentence on why: Claude Code
+turn and replies with a tier, one sentence on why, and the `## Automatic`
+class every changed file falls in, or none: Claude Code
`claude-haiku-5-5` at low effort, or Codex `gpt-6.1-sol` at low when Claude
Code is missing, logged out, has its login rejected, or hit its usage limit.
When neither can run, the review fails on the limit that resets first if both
@@ -1744,7 +1768,38 @@ the reason of the first to judge it so. The record names it after the base:
`Classified:` names `the always-high paths` or `default` when no model set the
tier, and a reviewer that raised it adds `- Raised the risk to high: `
-to its block.
+to its block. A `- Class:` line follows when the classifier named a class.
+
+A low head with no finding left to settle runs no local reviewer, unless
+`--harness`, `--model`, or `--effort` names one: the record names the head in
+full, adds `- Local review: none, since a low-risk head needs only the online
+reviewer`, and `next done` says so. A high head also gets a second reviewer:
+the first of the size's list on a model other than the pick's that can run,
+marked `second`, in a session of its own that reviews every head while the
+tier is high and settles its findings after. `--model` and `--effort` change
+only the pick, so the second reviewer still runs; the one reviewer `--harness`
+names runs alone, with none. A round that raises the tier to
+high saves its rounds and runs the second reviewer at once; when that review
+fails, as when none can run, it prints those rounds before the error, so their
+findings can be answered. When every other model is avoided, as
+with no `## Models` record under a harness the list has one model of, the run
+fails as a usage error; when they cannot run, as an outage.
+
+`--override --reason ` records the maintainer's tier for the
+branch in place of the reviewed one, as `- Risk: , ` and
+`- Overridden: from by the maintainer`. It holds across heads until
+the reviewed tier grows riskier than the one overridden, and `quest usage`
+counts overrides as a reading of the tier's accuracy.
+
+### Run the full suite
+
+`quest suite ` prints the base's `## Full suite` command when the PR's
+head needs it: its record names it high, or names no tier that covers the
+head. It prints nothing otherwise, so a repository's gate runs the command it
+prints beside its scoped checks. The tier is the PR body's, which its author
+writes, so a gate runs the full suite itself for an author without write
+access. `--base` names the branch whose `RISK.md` it reads, fetched first,
+by default origin's default branch.
### Score the reviewer
@@ -1867,8 +1922,12 @@ the record names, or its sub-agent, goes to that reviewer. Spend still left
fitting several, such as a routed and a shadow reviewer at one effort whose
sessions no record names, is split evenly among them and reported as `split`.
Each risk tier's PRs, how many merged,
-how many a reviewer raised, and how many a later PR's `## Caused by` names
-show whether the tiers predict what breaks. Each breakage a merged PR in the
+how many a reviewer raised, how many the maintainer overrode, how many a later
+PR's `## Caused by` names, and how long they waited on a person show whether
+the tiers predict what breaks and what each costs. Each `## Automatic` class
+the classifiers named gets the same numbers, and how many of its PRs were low,
+to argue for or against merging the class without a pick. A local reviewer
+row marked `second` shows what the high tier's second review catches. Each breakage a merged PR in the
window names under `## Caused by` follows on its own line, by culprit, even one
older than the window, which is read from GitHub: the culprit's tier, size,
writers, and local reviewers, who found it and the incident it closes when
diff --git a/RISK.md b/RISK.md
index a6ffbb70..5fc10d49 100644
--- a/RISK.md
+++ b/RISK.md
@@ -48,6 +48,21 @@ alone, or a routine dependency or pin bump.
Tests, plans under `quest/`, and documentation change nothing others rely
on, so they are low.
+## Automatic
+
+A low PR whose author has write access lands without the maintainer's pick
+when its whole diff falls in one class below. Only a PR the maintainer
+picks changes this list, proposed with `quest usage`'s numbers for the
+class: its PRs merged, the culprits among them, and their wait on a person.
+
+- `tests` - only tests, their fixtures, or benchmarks change
+- `internal-docs` - only comments, plans under `quest/`, or documentation
+ no user, contributor, or other repository reads change
+- `refactor` - code changes that keep every behavior and output the same,
+ such as a rename inside a module or a simplification
+- `trivial` - a dependency or pin bump, or another change as small, from
+ any author, which lands at any tier once Pullfrog approves its head
+
## High
- `assets/CONTEXT.md` - every agent session in every repository using
diff --git a/assets/skills/merge.md b/assets/skills/merge.md
index e4e38e08..be236c08 100644
--- a/assets/skills/merge.md
+++ b/assets/skills/merge.md
@@ -31,6 +31,7 @@ Otherwise, the changes since the reviewed head need no new review only when they
The repository's review policy decides whose record counts and may require more, such as a maintainer's review.
Where it says nothing, only a record on a PR whose author has write access counts: anyone else writes their own PR body, so their head needs a local review that rewrites the record.
On a trivial PR that `/quest-run`'s standing pick covers, Pullfrog's approval of the head stands in for that record unless that policy requires more.
+A low head's record counts without a local reviewer; a later head's rise in tier ends the pick: tell the user.
Queue the head with `quest merge --land `, adding `--squash` or `--rebase` when the repository's root instructions name that method for the PR's base.
Run a `quest` the PR cannot modify, such as an installed release rather than a build from the head's checkout: it refuses a head that leaves its quest inaccurate, a check the head's own code could skip.
diff --git a/assets/skills/review.md b/assets/skills/review.md
index 68963fde..9d391994 100644
--- a/assets/skills/review.md
+++ b/assets/skills/review.md
@@ -29,6 +29,9 @@ Pass `--exclude-model` or `--size` only for a PR whose body cannot hold the reco
Where the repository's root instructions name other reviewers, pass them with `--harness`, `--model`, and `--effort`, which runs that reviewer alone.
Each round rewrites the PR body's `## Review` section, so add context only after it, and write a round's record by hand only when it printed `record skipped`.
+`quest review` sets the head's risk tier before any reviewer runs: a low head gets no local reviewer, only a record saying so, and a high one gets a second reviewer on another model, which a round that raises the tier runs at once.
+When the user overrides the tier, pass it with `--override --reason `.
+
Each round ends with a `next` line: follow it until a round of the head reports no finding you have not refuted; never block on the score.
Fix in the PR every review finding relevant to it that you do not refute and every gap the change exposes; in other code you read, fix easy findings and suggest the rest as follow-ups.
Refute a finding only with evidence the reviewer cannot rebut: a `path:line`, a command's output, or a recorded maintainer decision.
diff --git a/assets/skills/run.md b/assets/skills/run.md
index cf7e6404..7814e61b 100644
--- a/assets/skills/run.md
+++ b/assets/skills/run.md
@@ -43,10 +43,10 @@ A PR with open decisions, its `## Waiting` section's or an issue you would solve
A PR you would skip or delete rather than fix, such as a superseded one, gets that question instead.
Leave a PR whose required checks are still running for a later round; an automated reviewer is not waited on, since the queue waits for an approval the base requires.
-A PR whose author has write access and that changes no user-facing behavior carries a standing `/quest-merge` pick, unless the repository's `CONTRIBUTING.md` opts out: run `/quest-merge` on it without asking, and name it as auto-picked in the summary.
-That covers only tests, benchmarks, CI, internal docs or comments, and behavior-preserving code. Anything users or other repositories get, such as CLI behavior or output, shipped skills or rules, user-facing docs, dependencies, or release artifacts, needs the user's pick, as does adding or expanding quests.
-A trivial PR, such as a dependency bump, carries it too whatever its author, under the same opt-out, but merges only once Pullfrog has approved its head; in a repository without Pullfrog, it needs the user's pick.
-Judge the diff, not the title, before every `/quest-merge` run, and ask when unsure: the standing pick ends at the first head that does not qualify, or once a person takes the PR out of the queue.
+A PR whose author has write access carries a standing `/quest-merge` pick, unless the repository's `CONTRIBUTING.md` opts out, when `quest status` shows it low for the head, in a class the base `RISK.md` lists under `## Automatic`, adding or expanding no quests: run `/quest-merge` on it without asking, and name it as auto-picked in the summary.
+A trivial PR, such as a dependency bump, carries it too whatever its author and tier, under the same opt-out, but merges only once Pullfrog has approved its head; in a repository without Pullfrog, it needs the user's pick.
+Judge the diff against the class's rule before every `/quest-merge` run, and ask when unsure: the standing pick ends at the first head that does not qualify, or once a person takes the PR out of the queue.
+Ask about a high PR with both reviews and the full suite's result.
Ask about every other PR in a question of its own that summarizes it and picks only the action, with `/quest-merge`'s pick options; none covers several PRs.
Ask about each of its follow-ups in a question of its own beside it, as the guide's Creation section describes; the answers count only on a `/quest-merge` pick, and go in the brief of the `/quest-iterate` it dispatches.
diff --git a/quest/m0/afk-and-waits.md b/quest/m0/afk-and-waits.md
index 8956abb5..ec23199b 100644
--- a/quest/m0/afk-and-waits.md
+++ b/quest/m0/afk-and-waits.md
@@ -4,11 +4,11 @@
Reduce repeated manual prompts during interactive, mobile/travel, and AFK sessions across three coordinated improvements:
-1. **`/quest-afk` modes (`assets/skills/afk.md`):** Keep bare `afk` conservative (standing picks only, deferring other merges until [risk-tier guardrails](/quest/m0/benchmark/guardrails.md) earn wider auto-merge), and add two explicit modes: `afk merge` (merge any non-high-risk PR the agent strongly recommends with a clean review and no open decisions, still deferring high-risk or uncertain PRs and quest deletions) and `afk soon` (flush pending decisions in one batch, then automatically enter `afk`).
+1. **`/quest-afk` modes (`assets/skills/afk.md`):** Keep bare `afk` conservative (standing picks only, deferring other merges until classes in [`RISK.md`](/RISK.md)'s `## Automatic` list earn wider auto-merge), and add two explicit modes: `afk merge` (merge any non-high-risk PR the agent strongly recommends with a clean review and no open decisions, still deferring high-risk or uncertain PRs and quest deletions) and `afk soon` (flush pending decisions in one batch, then automatically enter `afk`).
2. **PC-local vs tap-anywhere waits (`src/core/waiting.ts`, `quest waiting`, `quest check`, `assets/AGENTS.md`, `assets/skills/run.md`):** Distinguish local/PC maintainer actions (such as password-manager unlocks, hardware checks, or local logins) from decisions answerable from any device, with filtering on `quest waiting` so remote/travel sessions skip PC-local waits and `"at my PC"` sessions batch them.
3. **Pending-CI waiting in `/quest-run` (`assets/skills/run.md`):** When no sub-agent is running and every current question is asked, also block with `quest wait` on open PRs whose required checks are still pending (in addition to queued PRs whose merge unblocks a quest) so those PRs get picked in the same session instead of ending early.
-Non-goal: changing risk-tier definitions or automatic low-risk merge classes on bare `afk` (owned by [Scale review, CI, and approval to a PR's risk tier](/quest/m0/benchmark/guardrails.md)).
+Non-goal: changing risk-tier definitions or automatic low-risk merge classes on bare `afk` (set by [`RISK.md`](/RISK.md) and the README's Risk tiers section since [moq-dev/quest#802](https://github.com/moq-dev/quest/pull/802)).
## Plan
@@ -42,4 +42,4 @@ Agent's choices, for the implementer to revisit:
## Related
-- [Scale review, CI, and approval to a PR's risk tier](/quest/m0/benchmark/guardrails.md) - risk tiers define the `high` boundary `afk merge` defers and will widen standing auto-merge separately
+- [`RISK.md`](/RISK.md) and the README's Risk tiers section, since [moq-dev/quest#802](https://github.com/moq-dev/quest/pull/802) - risk tiers define the `high` boundary `afk merge` defers and will widen standing auto-merge separately
diff --git a/quest/m0/benchmark/README.md b/quest/m0/benchmark/README.md
index b738e761..92db762d 100644
--- a/quest/m0/benchmark/README.md
+++ b/quest/m0/benchmark/README.md
@@ -1,4 +1,4 @@
-# Development as a benchmark
+# [M] Development as a benchmark
## Goal
@@ -7,7 +7,7 @@ benchmark with several axes. Every change records its risk tier, what it
cost (tokens, compute, and time split into working and blocked on CI,
GitHub, git, or a person), who wrote and reviewed it, and what it later
broke. The tier, set from the change itself, scales its guardrails: review
-depth, CI, human approval, and a stated way to undo it. The maintainer
+depth, CI, and human approval. The maintainer
steers from a report of all of it without reading code, and adds or removes
guardrails from that evidence. Every cost is measured so it can be driven
toward zero.
@@ -67,9 +67,13 @@ maintainer's typed messages since 2026-10-01):
Rejected: set at planning and re-judged from the diff; a separate score
per axis.
- What does the tier scale?
- - ✅ Review, approval, and CI, as
- [tier guardrails](/quest/m0/benchmark/guardrails.md) lists
+ - ✅ Review, approval, and CI, as `RISK.md` and the README's Risk tiers
+ section describe since
+ [moq-dev/quest#802](https://github.com/moq-dev/quest/pull/802)
- Rejected: review and approval only; approval only
+- Must a PR state how to undo it? ✅ No (maintainer, 2026-11-22: "I
+ definitely don't want Undo to be a gate"). Rejected: an `## Undo`
+ section that `quest merge` requires of every PR not tiered low.
- Who moves a class of change into or out of automatic merging?
- ✅ The maintainer, both ways: the report flags a class whose breakage
rose, and it keeps merging until they act
@@ -82,12 +86,11 @@ maintainer's typed messages since 2026-10-01):
What the posts add that these quests take: a tier set from the change and
not its author, paths that always need a person, evidence and a brief
-read in place of the diff, a stated way to undo each change, automatic
-merging widened one class at a time on breakage data, and past incidents
-kept as a reviewer's test set. Already in place: a different model
-reviews each PR, every finding is answered before merge, a design
-checkpoint after repeated review rounds, a merge queue, and diff-scoped
-gates in moq-dev/moq and moq-dev/moq.pro.
+read in place of the diff, automatic merging widened one class at a time
+on breakage data, and past incidents kept as a reviewer's test set.
+Already in place: a different model reviews each PR, every finding is
+answered before merge, a design checkpoint after repeated review rounds,
+a merge queue, and diff-scoped gates in moq-dev/moq and moq-dev/moq.pro.
No post describes attributing cost, model, and effort to each change, so
that part has no precedent to copy.
diff --git a/quest/m0/benchmark/guardrails.md b/quest/m0/benchmark/guardrails.md
deleted file mode 100644
index d06879d1..00000000
--- a/quest/m0/benchmark/guardrails.md
+++ /dev/null
@@ -1,111 +0,0 @@
-# [L] Scale review, CI, and approval to a PR's risk tier
-
-## Goal
-
-A PR's guardrails follow its risk tier:
-
-| Tier | Review | CI | Lands on |
-|---|---|---|---|
-| Low | The online reviewer only | The checks its diff reaches | Its own, once its class of change is on the repository's list; else the maintainer's pick |
-| Medium | A local review by a model other than its writer | The checks its diff reaches | The maintainer's pick |
-| High | Two independent local reviews, on the strongest reviewers | The repository's full suite | The maintainer's pick, with the full brief |
-
-A medium or high PR states how to undo it in its body, and `quest merge`
-refuses one that does not. The tier replaces `/quest-run`'s standing pick:
-the classes that merge on their own are a list in the repository's risk
-file, starting with what the standing pick covers today, and only a PR the
-maintainer picks changes that list. Automatic merging stays limited to
-authors with write access, and to the trivial PRs of any author, such as
-dependency bumps, that the standing pick covers once Pullfrog approves
-their head.
-
-Each guardrail's cost and catches reach the PR's records: what each review
-found, what the full suite failed that the scoped checks passed, and how
-long the PR waited on a person. The report can then show a guardrail that
-catches nothing, so the maintainer can remove it.
-
-## Plan
-
-Decided 2026-11-13 (user, /quest-plan):
-
-- What does the tier scale? ✅ Review, approval, and CI (rejected: review
- and approval only, keeping CI scoped at every tier; approval only).
-- How do low-risk PRs land? ✅ Earned from evidence, starting with the
- standing pick's classes (rejected: every low PR from day one; every
- merge a tap).
-- Who moves a class? ✅ The maintainer, both ways. The report flags a class
- whose breakage rose and it keeps merging until they act. Rejected: a
- breaker that tightens on its own; automatic both ways.
-- Customer-facing changes get "rollbacks and higher quality" (user): the
- high tier's stated undo and second review.
-
-Decided 2026-11-15 (user, /quest-run, moq-dev/quest#738): trivial PRs
-merge on their own, so the starting list holds that class too.
-
-- Which PRs? ✅ Any trivial PR, such as a dependency bump, whatever its
- author, judged by its diff (rejected: only Dependabot's and Renovate's
- patch or lockfile-only bumps whose every commit is the bot's).
-- What review? ✅ Pullfrog's approval of the head, in place of the local
- review an author without write access needs (rejected: a local
- `quest review`; no review).
-
-Evidence from the 2026-11-18 [mistake audit](/quest/m0/mistake-audit.md)
-run: of 234 merge-pick answers from 2026-11-11 to 11-19, across the
-three repositories and the maintainer's hosts, 220 (94%) picked the PR the
-agent recommended. Follow-up keep-or-drop answers picked it 79% of the
-time, and other questions 73%. That supports widening the list once the
-tiers are trusted, not merging every pick on its own. Decided 2026-11-19
-(maintainer, merge pick of
-[moq-dev/quest#786](https://github.com/moq-dev/quest/pull/786)): ✅ keep
-this evidence here (rejected: drop).
-
-Decided 2026-11-21 (maintainer, /quest-run): a week of recorded tiers did
-not match their sense of risk, since high took 55% of PRs and nearly every
-code PR. [moq-dev/quest#794](https://github.com/moq-dev/quest/pull/794)
-narrowed high in `RISK.md` to breaking changes to exports, records, or
-output, new remote writes, uploads, or spending, merge authority,
-credentials, and the held paths. Re-tiered, the week's 56 tiered PRs went
-from 32 high to 22, with no low PR moving.
-
-This quest edits the shipped skills and rules, which the maintainer asked
-for by planning it.
-
-Agent's choices, for the implementer to revisit:
-
-- `quest` cannot run a repository's CI. Expose the tier to the gate, and
- let the risk file name the full-suite command, so moq-dev/moq's
- `just gate` and moq-dev/moq.pro's nightly tier run for a high PR and the
- scoped checks for the rest.
-- Size keeps picking the review effort within a tier. High adds a second
- reviewer on a different model from the first; the routing table gains
- that column.
-- A class is a named rule over the diff in the risk file, such as "only
- test files". A PR lands on its own only when it is low and every changed
- file falls in a listed class.
-- The undo line says which of revert, flag, or redeploy applies and what
- it leaves behind, such as a migration. Low PRs are undone by a revert
- and need no line.
-- A widening is proposed with its class's numbers: PRs merged, culprits
- among them, and what a tap cost in waiting time.
-- Tell the maintainer when a tier rises on a later head of a PR they
- already picked; the pick ends there, as the standing pick's does. A
- tier that rises reopens whatever the lower tier skipped.
-- The maintainer can override a tier, recorded with its reason, and the
- report counts how often they do as a reading of the tier's accuracy.
- [#716](https://github.com/moq-dev/quest/pull/716), which set the tier,
- left this here, since nothing reads an override until the tier gates
- something.
-
-Open question for the maintainer, asked before the list is written: the
-standing pick covers CI changes today, but the post requires a person for
-"any CI workflow file", and `quest review` holds workflow files always
-high. Recommended: keep them high, which takes CI changes out of
-automatic merging. That would also take out a trivial bump of a GitHub
-Action, which edits a workflow file: recommended to keep that class
-automatic, since the actions are pinned by SHA, Dependabot waits out a
-cooldown, and Pullfrog approves the head.
-
-## Related
-
-- [Routing evidence](/quest/m0/routing-evidence/README.md) - its shadow
- reviewer measures what a deeper review buys
diff --git a/quest/m0/routing-evidence/README.md b/quest/m0/routing-evidence/README.md
index 1d96bfca..4c66906c 100644
--- a/quest/m0/routing-evidence/README.md
+++ b/quest/m0/routing-evidence/README.md
@@ -120,7 +120,8 @@ three hosts' saved review rounds:
routed pick at S and M, to measure whether raising them pays, and one
below at L until L reaches its sample (rejected: unchanged until
12-20, then end it; end it now; a permanent second reviewer at L and
- XL, left to [the guardrails](/quest/m0/benchmark/guardrails.md)). XL
+ XL, left to the risk tiers, whose high tier seats a second reviewer
+ since [moq-dev/quest#802](https://github.com/moq-dev/quest/pull/802)). XL
keeps its step down with L. Compare the step up's pairs as the step
down's were, counting only rounds after the retarget merged.
- Writer A/B, PRs per arm, first-round findings over the PRs counted in
diff --git a/src/cli/main.ts b/src/cli/main.ts
index 190e2b5c..ce38c069 100644
--- a/src/cli/main.ts
+++ b/src/cli/main.ts
@@ -21,6 +21,8 @@ import {
parseRiskFile,
questBranch,
RISK_FILE,
+ TIERS,
+ type Tier,
renderBlocker,
FINDERS,
type Finder,
@@ -90,6 +92,7 @@ import {
review,
nextStep,
roundLines,
+ savedReview,
} from "./review";
import { EVAL_FILE, addCase, evalLines, evaluate } from "./review-eval";
import { type Recorded, pullModels, recordRounds } from "./review-record";
@@ -115,6 +118,7 @@ import { KIXEL_QUEST_URL, kixelUrl, tokensPath } from "./tokens";
import { CONTEXT, GUIDE, GUIDE_SECTIONS, SKILLS, guideSections, sectionHeading, skill } from "./skills";
import { type Terminal, Theme } from "./theme";
import { type Snapshot, checkout, collect, load, snapshot, under } from "./tree";
+import { baseRiskFile, suiteFor } from "./suite";
import { pullFileLines, statusLines, viewLines } from "./status";
import { TOKEN_MAX_MISSING, daysBefore, runTokenMax, usage, usageDependencies, usageLines } from "./usage";
import { waitForActivity, WaitTimeout } from "./wait";
@@ -665,12 +669,12 @@ export function main(argv: string[], out: Output): number | Promise {
"Print a pull request's head, checks, merge state, reviews, reactions, and unresolved review threads " +
"in one call. It reports facts; it does not decide whether the PR is ready or whose review counts.\n\n" +
"Plain output prints one record per line, its type first and any free text (a check name or path) last: " +
- "url, state, draft, head, mergeable, merge-state, review-decision, review-record, risk, auto-merge, merge-queue, " +
+ "url, state, draft, head, mergeable, merge-state, review-decision, review-record, risk, class, auto-merge, merge-queue, " +
"landing-stopped, and checks, whose state and counts follow the checks that count, pending while an open PR's base requires a check or workflow nothing reports; review-record gives whether the PR body's ## Review record " +
"covers the head, as current, diff-identical (git diff ... prints the same as for the head it names), " +
"stale, or unknown when GitHub cannot compare them, then the head it names last; risk gives the record's risk " +
"tier, the same state for its head, the tier its classifier set before any reviewer raised it, and the " +
- "reason last, or - when the record names none; auto-merge gives its method, who enabled it and when, and the head it was " +
+ "reason last, or - when the record names none; class gives the RISK.md ## Automatic class the record's classifier named, or -; auto-merge gives its method, who enabled it and when, and the head it was " +
"enabled on, which differs from head once a push follows, as GitHub keeps auto-merge across a writer's " +
"push (- when it cannot be told: a quest land pin names it, and otherwise the head branch's push " +
"activity, which GitHub lists up to minutes late); landing-stopped is the latest exit from the merge queue, auto-merge, or " +
@@ -713,6 +717,42 @@ export function main(argv: string[], out: Output): number | Promise {
);
});
+ program
+ .command("suite")
+ .summary("Print the full-suite command a PR's risk tier calls for")
+ .description(
+ "Print the command in the ## Full suite section of the base's RISK.md when the PR's head needs the " +
+ "repository's whole test suite beyond the checks its diff reaches: its ## Review record names it high " +
+ "risk, or names no tier that covers the head, as when it is missing, stale, or cannot be compared. " +
+ "Prints nothing for a low or medium head, or when RISK.md names no full suite, so a repository's gate " +
+ "runs `cmd=$(quest suite )` and then the command when one printed. The tier is the PR body's, which " +
+ "its author writes, so a gate gives a PR from an author without write access the full suite itself. " +
+ "RISK.md is read from --base, fetched first, by default origin's default branch.\n\n" +
+ "Uses GH_TOKEN, GITHUB_TOKEN, or gh auth token. " +
+ FORGE_READS.replace("these reads", "the read") +
+ "Exits 0 whatever it prints, 2 for invalid arguments, and 1 for other failures, such as a RISK.md it " +
+ "cannot read.",
+ )
+ .argument("", PR_ARGUMENT)
+ .option("--base ", "Base branch whose RISK.md to read (default: origin's default branch)")
+ .action((value: string, options: { base?: string }) => {
+ const { pull: pr, hosted } = locatePull(value, root(), process.env);
+ pending = Promise.all([
+ forgeFor(pr, forgeDependencies(), Infinity, hosted).then((forge) => forge.status(pr)),
+ baseRiskFile(root(), options.base),
+ ]).then(
+ ([{ value: status }, file]) => {
+ const command = suiteFor(status.risk, file);
+ if (command !== null) print(command);
+ return 0;
+ },
+ (error: unknown) => {
+ warn(error instanceof Error ? error.message : String(error));
+ return 1;
+ },
+ );
+ });
+
const OWNERSHIP =
"Before a session pushes to an existing PR, it takes the PR with iterate, and hands it back with " +
"release. A taken PR carries the quest:active label; iterate prints a hold token, the ID of the timeline " +
@@ -1426,8 +1466,8 @@ export function main(argv: string[], out: Output): number | Promise {
"review thread it opens or a [P] line in its review body, and its first answer's first word takes or " +
"declines it. Rollups follow: spend by size, role, harness, model, and " +
"effort, accuracy by size and implementer, summing each branch's tallies but the shadow's once, where an Implementer line's own size, as (iterate, XS), wins " +
- "over the PR's, with its writing cost over the merged PRs it was found on, the writer A/B by size and arm, counting a sized PR whose every Implementer line names the same arm, as (arm B), under its first line's writer with the spend of every session on it, local reviewers by size, harness, model, effort, and shadow, with their " +
- "tallies and reviewing cost per PR, each risk tier's PRs, merged PRs, tiers a reviewer raised, and PRs a later one fixed, each online reviewer's coverage and findings over the merged PRs, and each breakage a merged PR in the window names under ## Caused by: its culprit's tier, size, writers, and local reviewers, read from GitHub when older than the window, who found it and the incident it closes when the line ends with (found by check|reviewer|queue|canary|person|customer; incident ), either part alone allowed, and how long after the culprit merged the fix opened. Without token-max on PATH, it says how to install it and reports the PRs' records alone. " +
+ "over the PR's, with its writing cost over the merged PRs it was found on, the writer A/B by size and arm, counting a sized PR whose every Implementer line names the same arm, as (arm B), under its first line's writer with the spend of every session on it, local reviewers by size, harness, model, effort, and shadow or second, with their " +
+ "tallies and reviewing cost per PR, each risk tier's PRs, merged PRs, tiers a reviewer raised, tiers the maintainer overrode, PRs a later one fixed, and time waited on a person, the same for each RISK.md ## Automatic class the classifiers named, with how many were low, each online reviewer's coverage and findings over the merged PRs, and each breakage a merged PR in the window names under ## Caused by: its culprit's tier, size, writers, and local reviewers, read from GitHub when older than the window, who found it and the incident it closes when the line ends with (found by check|reviewer|queue|canary|person|customer; incident ), either part alone allowed, and how long after the culprit merged the fix opened. Without token-max on PATH, it says how to install it and reports the PRs' records alone. " +
"--json prints the same report as one object.\n\n" +
"Uses GH_TOKEN, GITHUB_TOKEN, or gh auth token. Exits 0 when done, 2 for invalid arguments, and 1 for " +
"other failures.",
@@ -1614,7 +1654,14 @@ export function main(argv: string[], out: Output): number | Promise {
).join("; ");
const classifiers = CLASSIFIERS.map((e) => `${e.harness} ${e.model} ${e.effort}`).join(", then ");
/** quest review's exit code for `error`: 2 for a usage error, 3 when no reviewer could run, else 1. */
- const reviewFailure = (error: unknown): number => {
+ const reviewFailure = (error: unknown, json = false): number => {
+ // A failure after a raise saved the rounds that ran, so they print for their findings to be answered.
+ const reviewed = savedReview(error);
+ if (reviewed !== undefined) {
+ const { rounds, tallies, risk, skipped } = reviewed;
+ if (json) print(JSON.stringify({ rounds, tallies, risk, skipped, record: null, next: null }));
+ else for (const line of roundLines(reviewed)) print(line);
+ }
const outage = error instanceof ReviewerUnavailableError || error instanceof ReviewOutageError;
if (error instanceof ReviewInputError || outage) {
out.stderr(`error: ${error.message}\n`);
@@ -1702,24 +1749,34 @@ export function main(argv: string[], out: Output): number | Promise {
"API rejects, or at its usage limit passes the turn to the next; when none is left, the run fails on the " +
"limit that resets first if every one hit its own, else as a usage error naming why each failed. A later round on the same head and base " +
"RISK.md reuses the tier unless --new. Each reviewer's reply judges the tier too, told the classified one, " +
- "and can only raise it: the head's tier is the riskiest, with the reason of the first to judge it so.\n\n" +
+ "and can only raise it: the head's tier is the riskiest, with the reason of the first to judge it so. " +
+ "The classifier also names the class of RISK.md's ## Automatic list every changed file falls in, or none. " +
+ "The tier scales the review: a low head with no finding to settle runs no reviewer unless --harness, " +
+ "--model, or --effort names one, and a high head also gets a second reviewer: the first of the size's list " +
+ "on a model other than the pick's that can run, in its own session, which reviews every head while the " +
+ "tier is high and settles its findings after. --model and --effort change only the pick, so the second " +
+ "reviewer still runs; the one reviewer --harness names runs alone, with none. A round that raises the tier to high saves its rounds and " +
+ "runs it at once, printing those rounds before the error when that review fails, as when no second reviewer can run. " +
+ "--override and --reason record the maintainer's tier for the branch, which holds until the reviewed " +
+ "tier grows riskier than the one overridden.\n\n" +
"Prints the size and where it came from, base, and head, its risk tier and reason, the classifier's tier, " +
- "how it was set (model, paths, or default), and reason, and for a model a classifier line (harness, model, " +
+ "an overridden line with the tier the maintainer overrode, " +
+ "how it was set (model, paths, or default), and reason, a class line naming the class, and for a model a classifier line (harness, model, " +
"effort, session) and its usage line, a skipped line (harness, model, effort, reason) for each reviewer passed over, then for each reviewer its harness, model, and " +
- "effort, followed by shadow for the shadow, session, round, an " +
+ "effort, followed by shadow for the shadow or second for the second reviewer, session, round, an " +
"unchanged line for a repeated round, a usage line per turn (input tokens, the " +
"part read from the prompt cache, and output), a score from 0 to 10 for how ready the head is to land with " +
"its one-sentence rationale, a raised line with the tier and reason when it raised the classifier's, the finding count, each finding by its number, then the last round's findings with " +
"their numbers and dispositions; then the `record` line below and a last `next` line naming the author's next step: " +
"`next finish` when every finding is low severity, to fix or refute them without another round, " +
"`next checkpoint` when a reviewer's every third round reports other findings, to compare the current approach " +
- "with the best long-term approach worked out from first principles before fixing them, `next respond` to fix or refute the findings, or `next done`. A reply without a valid score " +
+ "with the best long-term approach worked out from first principles before fixing them, `next respond` to fix or refute the findings, or `next done`, which for a low head no reviewer ran says so. A reply without a valid score " +
"fails as any malformed reply does. --json prints " +
"one object: `rounds`, one per reviewer, `tallies`, every reviewer's findings across the branch's rounds, `risk`, the head's tier with its classification, `skipped`, each reviewer passed over with its reason, `record`, and `next`.\n\n" +
"After each round, it rewrites the `## Review` section of the branch's open PR into the base, the one from the repository the base's remote pushes to, else the only one from another repository whose pushed head `HEAD` contains, as the " +
"user the GitHub token names, keeping the rest of the body, and prints `record `: the reviewed " +
"head, named in full only once no reviewer reports a finding, the base, the head's risk tier and reason, " +
- "the classifier's tier and who set it, a `- Skipped:` line for each reviewer passed over, and each reviewer, its Reviewer line ending in `, shadow` for the shadow, its " +
+ "an `- Overridden:` line, the classifier's tier and who set it, a `- Class:` line, a `- Local review: none` line for a low head no reviewer ran on, a `- Skipped:` line for each reviewer passed over, and each reviewer, its Reviewer line ending in `, shadow` for the shadow or `, second` for the second reviewer, its " +
"session and round, score, the tier it raised the risk to and why, its tally of findings across the branch's rounds, and each finding with its disposition. With no " +
"such PR, several from other repositories that `HEAD` contains, or a remote off GitHub, it prints `record skipped: ` and changes nothing.\n\n" +
"Exits 0 once the round finishes, whatever it found, 2 for invalid arguments " +
@@ -1762,11 +1819,20 @@ export function main(argv: string[], out: Output): number | Promise {
"--branch ",
"Branch whose review session to continue, instead of the checked-out one or its upstream",
)
+ .addOption(
+ new Option(
+ "--override ",
+ "The maintainer's tier for the branch, in place of the reviewed one until its change grows riskier",
+ ).choices(TIERS),
+ )
+ .option("--reason ", "Why the maintainer overrode the tier, which --override requires")
.option("--json", "Print one JSON object")
.action(
(options: {
base?: string;
branch?: string;
+ override?: Tier;
+ reason?: string;
harness?: HarnessName;
model?: string;
effort?: string;
@@ -1780,47 +1846,63 @@ export function main(argv: string[], out: Output): number | Promise {
options.responses === undefined
? undefined
: readFileSync(options.responses === "-" ? 0 : options.responses, "utf8");
+ if ((options.override === undefined) !== (options.reason === undefined))
+ throw new UsageError("--override and --reason go together");
+ const reason = options.reason?.replace(/\s+/g, " ").trim();
+ if (reason === "") throw new UsageError("--reason needs the maintainer's reason");
+ const override =
+ options.override === undefined ? undefined : { tier: options.override, reason: reason! };
const github = claimDependencies();
const run = review(
- { ...options, root: root(), exclude: options.excludeModel, responses, fresh: options.new },
+ {
+ ...options,
+ root: root(),
+ exclude: options.excludeModel,
+ responses,
+ fresh: options.new,
+ override,
+ },
{
...reviewDependencies(),
models: (dir, base, branch) => pullModels(dir, base, branch, github),
},
);
- pending = run.then(async (reviewed) => {
- const { rounds, tallies, risk, skipped } = reviewed;
- // The rounds are saved in their sessions either way, so their report prints before a failed record.
- let record: Recorded | undefined;
- let failure: unknown;
- try {
- record = await recordRounds(root(), reviewed, github);
- } catch (error) {
- failure = error;
- }
- if (options.json)
- print(
- JSON.stringify({
- rounds,
- tallies,
- risk,
- skipped,
- record: record ?? null,
- next: nextStep(rounds),
- }),
+ pending = run.then(
+ async (reviewed) => {
+ const { rounds, tallies, risk, skipped } = reviewed;
+ // The rounds are saved in their sessions either way, so their report prints before a failed record.
+ let record: Recorded | undefined;
+ let failure: unknown;
+ try {
+ record = await recordRounds(root(), reviewed, github);
+ } catch (error) {
+ failure = error;
+ }
+ if (options.json)
+ print(
+ JSON.stringify({
+ rounds,
+ tallies,
+ risk,
+ skipped,
+ record: record ?? null,
+ next: nextStep(rounds),
+ }),
+ );
+ else {
+ for (const line of roundLines(reviewed)) print(line);
+ if (record !== undefined)
+ print("url" in record ? `record ${record.url}` : `record skipped: ${record.skipped}`);
+ print(nextStep(rounds));
+ }
+ if (failure === undefined) return 0;
+ warn(
+ `the round finished, but recording it in the PR body failed: ${failure instanceof Error ? failure.message : String(failure)}`,
);
- else {
- for (const line of roundLines(reviewed)) print(line);
- if (record !== undefined)
- print("url" in record ? `record ${record.url}` : `record skipped: ${record.skipped}`);
- print(nextStep(rounds));
- }
- if (failure === undefined) return 0;
- warn(
- `the round finished, but recording it in the PR body failed: ${failure instanceof Error ? failure.message : String(failure)}`,
- );
- return 1;
- }, reviewFailure);
+ return 1;
+ },
+ (error) => reviewFailure(error, options.json),
+ );
},
);
diff --git a/src/cli/review-record.ts b/src/cli/review-record.ts
index fa187a7a..844bb312 100644
--- a/src/cli/review-record.ts
+++ b/src/cli/review-record.ts
@@ -37,9 +37,12 @@ function code(text: string): string {
const capitalized = (word: string) => word[0]!.toUpperCase() + word.slice(1);
-/** A block's Reviewer line, ending in `, shadow` for the shadow, the size's pick one effort away. */
-const reviewerLine = (seat: Pick) =>
- `- Reviewer: ${HARNESSES[seat.reviewer]}, ${seat.model}, ${seat.effort} effort${seat.shadow ? ", shadow" : ""}`;
+/**
+ * A block's Reviewer line, ending in `, shadow` for the shadow, the size's pick one effort away, or `, second` for the
+ * second reviewer a high-risk head gets.
+ */
+const reviewerLine = (seat: Pick) =>
+ `- Reviewer: ${HARNESSES[seat.reviewer]}, ${seat.model}, ${seat.effort} effort${seat.shadow ? ", shadow" : seat.second ? ", second" : ""}`;
/** A tally's counts, as the record's `Rounds:` line and `quest usage` write them. */
export interface Counts {
@@ -88,8 +91,7 @@ function classifiedBy({ by }: Risk["classified"]): string {
* reviewer the run skipped since it could not run, then every tally on the branch, each round's reviewer's beside its
* round, and a reviewer the run left out on its own.
*/
-export function reviewRecord({ rounds, tallies, risk, skipped }: Reviewed): string {
- const [shared] = rounds;
+export function reviewRecord({ rounds, tallies, risk, skipped, head, base }: Reviewed): string {
// A reviewer the run left out may still hold open findings, which keep the head from passing too.
const clean =
rounds.every((round) => round.findings.length === 0) && tallies.every((tally) => counted(tally).open === 0);
@@ -97,10 +99,13 @@ export function reviewRecord({ rounds, tallies, risk, skipped }: Reviewed): stri
MARK,
"",
// `quest status` counts a full SHA here as a review of that head, which an open finding has not passed.
- `- Head: ${clean ? shared!.head : `${shared!.head.slice(0, 12)}, named in full once no reviewer reports a finding`}`,
- `- Base: ${shared!.base.ref} at ${shared!.base.sha.slice(0, 12)}`,
+ `- Head: ${clean ? head : `${head.slice(0, 12)}, named in full once no reviewer reports a finding`}`,
+ `- Base: ${base.ref} at ${base.sha.slice(0, 12)}`,
`- Risk: ${risk.tier}, ${code(risk.reason)}`,
+ ...(risk.overridden ? [`- Overridden: from ${risk.overridden} by the maintainer`] : []),
`- Classified: ${risk.classified.tier} by ${classifiedBy(risk.classified)}`,
+ ...(risk.classified.class === null ? [] : [`- Class: \`${risk.classified.class}\``]),
+ ...(rounds.length === 0 ? [`- Local review: none, since a low-risk head needs only the online reviewer`] : []),
// Outside the Reviewer blocks, which `parseReview` reads as reviewers that ran.
...skipped.map(
(skip) => `- Skipped: ${HARNESSES[skip.harness]}, ${skip.model}, ${skip.effort} effort: ${skip.reason}`,
@@ -151,6 +156,8 @@ export interface ReviewSummary {
effort: string;
/** Whether it is the shadow: the size's pick one effort away, beside it on the same heads. */
shadow: boolean;
+ /** Whether it is the second reviewer a high-risk head gets, on a model other than the pick's. */
+ second: boolean;
/** Its latest session, null when the record names none; its round, null when the latest run left it out. */
session: string | null;
round: number | null;
@@ -209,7 +216,7 @@ export function parseReview(body: string): ReviewSummary[] {
if (!found) throw new Error(`the ## Review record has no line matching ${pattern.source}`);
return found;
};
- const reviewer = match(/^- Reviewer: (.+?), (\S+), (\S+) effort(, shadow)?\r?$/m);
+ const reviewer = match(/^- Reviewer: (.+?), (\S+), (\S+) effort(?:(, shadow)|(, second))?\r?$/m);
const tally = parseCounts(text);
// A reviewer the latest run left out has its tally, and its session with no round once tallies name it.
const session =
@@ -229,6 +236,7 @@ export function parseReview(body: string): ReviewSummary[] {
model: reviewer[2]!,
effort: reviewer[3]!,
shadow: reviewer[4] !== undefined,
+ second: reviewer[5] !== undefined,
session: session && session[2]!,
round: session?.[3] === undefined ? null : Number(session[3]),
score: score ? Number(score[1]) : null,
@@ -352,8 +360,7 @@ export async function pullModels(
/** Record a run in the `## Review` section of its branch's open PR. The edit is the token's user's, which `/quest-merge` counts only when that user wrote the PR. */
export async function recordRounds(root: string, reviewed: Reviewed, deps: ClaimDependencies): Promise {
- const [shared] = reviewed.rounds;
- const pull = await openPull(root, shared!.base.ref, shared!.branch, deps);
+ const pull = await openPull(root, reviewed.base.ref, reviewed.branch, deps);
if ("skipped" in pull) return pull;
const next = withReview(pull.body, reviewRecord(reviewed));
if (next !== pull.body) await pull.edit(next);
diff --git a/src/cli/review.ts b/src/cli/review.ts
index f10136e2..b72b312d 100644
--- a/src/cli/review.ts
+++ b/src/cli/review.ts
@@ -58,6 +58,9 @@ export class ResponsesError extends ReviewInputError {}
* limit. `reason` is the short form the review record names it by.
*/
export class ReviewerUnavailableError extends Error {
+ /** Whether the second reviewer, rather than the pick or its shadow, could not run. */
+ second = false;
+
constructor(
readonly harness: HarnessName,
readonly reason: string,
@@ -84,6 +87,14 @@ export interface Skip extends Model {
reason: string;
}
+/** The rounds a run saved before the second review a raise called for failed, by the error that stopped it. */
+const savedBefore = new WeakMap