{"name":"codex-review-loop","title":"Run an independent review loop","description":"Run an independent AI code review on a pull request in rounds until a round returns only lowest-severity findings: start the reviewer in the background writing to a file, read only the reviewer's final message, check every finding against the code before acting, fix everything above the lowest severity with a check you watched fail by breaking the fix on purpose, measure each finding's effect on any published result, write a review record per round, split the pull request when rounds keep finding new kinds of bug, and merge only a head whose required checks ran on that exact commit. Symptoms: run codex review, get a second opinion on this PR, review until clean, the reviewer flagged a P1, is this ready to merge, codex review --base origin/main. The Blocks-hosted review loop is request-blocks-review's; containing a risky change is land-complex-change's.","compatibility":"A git repository with a pull request, or a branch and its base, and a reviewer CLI that reviews a diff against a base and grades findings by severity. The examples use the Codex CLI; any reviewer with those two properties fits. Merge checks use the GitHub CLI. Output is the fixed branch, one review record per round, and either a merge pinned to the reviewed head or the stated reason it is not ready.","allowedTools":"Read Write Edit Grep Glob Bash","license":"MIT","kind":"general","useWhen":"a pull request is ready for an independent review round before it merges","group":"workflow","lifecycle":"release","version":"1.0.1","author":"crissmoldovan","install":["npx skills add crissmoldovan/agent-skills --skill codex-review-loop"],"asks":["Run codex review on this PR against origin/main in the background, writing to a file. Read only the\nfinal review. Fix every P0, P1 and P2 with a check you have watched fail, write the round's\nreview record, and go again until a round comes back with only P3s.","The reviewer says the parser drops empty rows. Before you change anything, show me that it is true:\nthe line it means, and an input that proves it.","This PR changes numbers in a published report. For every finding, tell me whether fixing it moves a\npublished number, and by how much. Do not write \"no effect\" unless you measured it.","That is the fourth round in a row that found a new kind of bug. Stop iterating, and propose how to\nsplit this PR so that the part that keeps failing gets its own branch."],"commands":["# Fail fast: a command that fails stops the recipe, so nothing after it runs on a false premise —\n# no review of a tree that was never fetched, no round counted after a failed review.\nset -euo pipefail\n\n# One round of review. It never merges: the merge is a person's act, after step 14's checklist.\n# REVIEW_LOGS is absolute, outside the review tree and every worktree of this checkout.\n: \"${ROUND:?set ROUND to the number of this round}\"\n: \"${REVIEW_LOGS:?set REVIEW_LOGS to an absolute directory outside the repository}\"\ncase \"$REVIEW_LOGS\" in /*) ;; *) echo \"REFUSE: REVIEW_LOGS must be an absolute path\"; exit 1;; esac\n\n# A round counts only if the reviewer exited zero AND wrote a non-empty final review, which the exec\n# form writes, and only that, to the file -o names: no log marker can cut it. A failed round leaves none.\nreview_round() {  # review_round <n> <tree> <base sha>\n  local tree_abs listed wt wt_abs logs_abs log final\n  case \"$REVIEW_LOGS\" in /*) ;; *) echo \"ROUND $1 REFUSED: REVIEW_LOGS must be an absolute path\"; return 1;; esac\n  # The reviewer gets the recorded sha, never a name it would resolve for itself when it starts.\n  [[ \"${3:-}\" =~ ^[0-9a-f]{40}([0-9a-f]{24})?$ ]] || { echo \"ROUND $1 REFUSED: the base must be the recorded sha, not a name\"; return 1; }\n  tree_abs=$(cd \"$2\" && pwd -P) && mkdir -p \"$REVIEW_LOGS\" && logs_abs=$(cd \"$REVIEW_LOGS\" && pwd -P) || return 1\n  # The reviewed tree, then every worktree of this checkout, the checkout included. NUL-delimited (-z,\n  # git 2.36+): a path may hold a newline. A list git did not finish has no END record, and refuses.\n  while IFS= read -r -d '' wt; do\n    case $wt in END) listed=yes; continue;; \"worktree \"*) wt=${wt#worktree };; *) continue;; esac\n    wt_abs=$(cd \"$wt\" 2>/dev/null && pwd -P) || wt_abs=$wt\n    case \"$logs_abs/\" in \"$wt_abs\"/*|\"$wt\"/*) echo \"ROUND $1 REFUSED: REVIEW_LOGS is inside the reviewed tree or a worktree of this checkout: $wt\"; return 1;; esac\n  done < <(printf 'worktree %s\\0' \"$tree_abs\"; git worktree list --porcelain -z && printf 'END\\0')\n  [ \"${listed:-}\" = yes ] || { echo \"ROUND $1 REFUSED: git could not list this checkout's worktrees\"; return 1; }\n  # The reviewer takes nothing from the tree: -c turns off its instruction files; these two no flag does.\n  for wt in .codex .agents; do if [ -e \"$2/$wt\" ] || [ -L \"$2/$wt\" ]; then echo \"ROUND $1 REFUSED: the reviewed tree holds $wt, which configures its reviewer\"; return 1; fi; done\n  log=\"$logs_abs/round-$1.log\"; final=\"$logs_abs/round-$1.final.txt\"\n  rm -f \"$final\" \"$logs_abs/round-$1.dispositions\"  # nothing from an earlier run stands in for this one\n  (cd \"$2\" && codex exec review -c project_doc_max_bytes=0 --base \"$3\" -o \"$final\") > \"$log\" 2>&1 &\n  wait $! || { rm -f \"$final\"; echo \"ROUND $1 FAILED: the reviewer exited non-zero; not a clean round\"; return 1; }\n  grep -q '[^[:space:]]' \"$final\" 2>/dev/null \\\n    || { rm -f \"$final\"; echo \"ROUND $1 FAILED: no final review was written; not a clean round\"; return 1; }\n}\n\n# A round is terminal only if every grade in its final review is the lowest of the declared scale, for\n# the Codex CLI P3. Any other grade, above it or outside the scale (a P4), is not: never merge on it.\nterminal_round() {  # terminal_round <n>\n  local final=\"$REVIEW_LOGS/round-$1.final.txt\" other\n  [ -s \"$final\" ] || { echo \"NOT TERMINAL: round $1 has no final review\"; return 1; }\n  other=$(grep -Eo '\\[P[0-9]+\\]' \"$final\" | sort -u | grep -vx '\\[P3\\]' || true)\n  [ -z \"$other\" ] || { echo \"NOT TERMINAL: round $1 grades findings other than the lowest, P3:\" $other; return 1; }\n}\n\n# HEAD is the sha and git lists nothing, ignored files included. A git that failed proves nothing: fail.\nexact_tree() {  # exact_tree <tree> <sha>\n  local head status; head=$(git -C \"$1\" rev-parse HEAD) && status=$(git -C \"$1\" status --porcelain --ignored) || return 1\n  [ \"$head\" = \"$2\" ] && [ -z \"$status\" ]\n}\n\n# A round number is reserved atomically, by mkdir, and never reused. Review exactly the pushed bytes in a\n# fresh detached worktree, never the checkout, whose ignored files `git status --porcelain` hides.\nmkdir -p \"$REVIEW_LOGS\" && mkdir \"$REVIEW_LOGS/round-$ROUND.lock\" 2>/dev/null || { echo \"REFUSE: round $ROUND is taken: it ran, or is running; review as a new round\"; exit 1; }\ngit fetch origin\nsha=$(git rev-parse '@{upstream}'); base=$(git rev-parse origin/main)\nscratch=$(mktemp -d \"${TMPDIR:-/tmp}/review-tree.XXXXXX\"); tree=\"$scratch/tree\"\ntrap 'git worktree remove --force \"$tree\" 2>/dev/null || rm -rf \"$tree\"; rm -rf \"$scratch\"; git worktree prune' EXIT\ngit worktree add --detach \"$tree\" \"$sha\"\nexact_tree \"$tree\" \"$sha\" || { echo \"REFUSE: the review tree is not exactly $sha\"; exit 1; }\nreview_round \"$ROUND\" \"$tree\" \"$base\"    # a failed round stops here, before anything is pinned\n# Check again: a reviewer that wrote into the tree, built there or moved HEAD reviewed something else.\nexact_tree \"$tree\" \"$sha\" || { rm -f \"$REVIEW_LOGS/round-$ROUND.final.txt\"; echo \"ROUND $ROUND FAILED: the review tree changed while it was reviewed, or git could not tell; nothing is pinned\"; exit 1; }\necho \"$sha\" > \"$REVIEW_LOGS/round-$ROUND.head\"; echo \"$base\" > \"$REVIEW_LOGS/round-$ROUND.base\"\nterminal_round \"$ROUND\"          # so does a round with P0-P2 findings left\necho \"Round $ROUND is terminal. Record a complete disposition per finding in round-$ROUND.dispositions; a review\"\necho \"that grades none failed, unless you read it and record it clean:. Then work through step 14's checklist.\""],"documents":[{"path":"references/arming-a-fix.md","slug":"arming-a-fix","title":"Arming a fix","body":"# Arming a fix\n\nA check written for a fix and green from its first run proves that the check runs. It does not prove\nthat it would notice the fix going missing. Arming is how that is proven: break the fix on purpose,\nwatch the check fail, put the fix back, watch it pass. It takes a minute, and it is the difference\nbetween a guard and a decoration.\n\n## The procedure\n\n```bash\n# 1. Byte-copy the fixed file before touching it. The fix is usually uncommitted.\ncp path/to/file.ext \"$SCRATCH/file.ext.fixed\"\n\n# 2. Break the fix on purpose: invert the condition, delete the guard, return the old value.\n#    Edit one thing, so the failure can only come from that.\n\n# 3. Run the check. It must FAIL, and for the right reason.\n<check command>\n\n# 4. Restore from the byte copy, never from version control.\ncp \"$SCRATCH/file.ext.fixed\" path/to/file.ext\n\n# 5. Prove the restore by content before believing any test result.\ncmp path/to/file.ext \"$SCRATCH/file.ext.fixed\"\ngrep -c '<an identifier that only the fix introduces>' path/to/file.ext\n\n# 6. Run the check again. It must PASS.\n<check command>\n```\n\nRecord the mutation, the failing output (the line that says why it failed), and the passing run in\nthe round's review record.\n\n## Failing for the right reason\n\nRead the failure. A mutation that leaves a syntax error, a missing import or a renamed symbol makes\nalmost any test fail, and that failure says nothing about whether the test checks the behaviour.\nThe failure should be the assertion that names the behaviour the fix restored: the expected value,\nthe refused input, the row that should not be written.\n\nIf the check passes with the fix broken, the check is not guarding the fix. Rewrite it until it\nfails, or record that the fix is unguarded and why.\n\n## Why not version control\n\n`git checkout -- <file>`, `git restore <file>` and `git stash` all put back the last committed\nversion of the file. The fix being armed is usually uncommitted, in that same file, so each of them\nremoves the mutation and the fix together. Nothing reports it: the command exits zero and prints\nnothing. The next test run passes too, either because the fix's own test went with it or because\nnothing else calls the code. The only sign is the fix's absence, and nobody looks for an absence\nafter a green run. That is why step 5 checks content, not test results.\n\nThe byte copy has one more advantage: it restores exactly the state you armed, including other\nuncommitted edits in the file that belong to the same round.\n\n## Checks that are not tests\n\nNot every fix lives in code a test can reach. A data correction, a configuration value or a\ndocument can be armed the same way with a self-check: a script, query or assertion that reads the\nartefact and fails when the fix is absent. Break the artefact from a byte copy, watch the self-check\nfail, restore, watch it pass.\n\n## Arming the other side\n\nSome checks compare two things: code against a seed file, a registry against what it registers, a\nmanifest against the files it lists. Mutating one side proves the check notices that side moving.\nIt proves nothing about the other side. Arm both: break the code and watch it fail; restore; break\nthe data and watch it fail; restore.\n","bodyHtml":"<h2 id=\"arming-a-fix\">Arming a fix</h2>\n<p>A check written for a fix and green from its first run proves that the check runs. It does not prove\nthat it would notice the fix going missing. Arming is how that is proven: break the fix on purpose,\nwatch the check fail, put the fix back, watch it pass. It takes a minute, and it is the difference\nbetween a guard and a decoration.</p>\n<h3 id=\"the-procedure\">The procedure</h3>\n<pre><code class=\"language-bash\"># 1. Byte-copy the fixed file before touching it. The fix is usually uncommitted.\ncp path/to/file.ext &quot;$SCRATCH/file.ext.fixed&quot;\n\n# 2. Break the fix on purpose: invert the condition, delete the guard, return the old value.\n#    Edit one thing, so the failure can only come from that.\n\n# 3. Run the check. It must FAIL, and for the right reason.\n&lt;check command&gt;\n\n# 4. Restore from the byte copy, never from version control.\ncp &quot;$SCRATCH/file.ext.fixed&quot; path/to/file.ext\n\n# 5. Prove the restore by content before believing any test result.\ncmp path/to/file.ext &quot;$SCRATCH/file.ext.fixed&quot;\ngrep -c &#39;&lt;an identifier that only the fix introduces&gt;&#39; path/to/file.ext\n\n# 6. Run the check again. It must PASS.\n&lt;check command&gt;\n</code></pre>\n<p>Record the mutation, the failing output (the line that says why it failed), and the passing run in\nthe round&#39;s review record.</p>\n<h3 id=\"failing-for-the-right-reason\">Failing for the right reason</h3>\n<p>Read the failure. A mutation that leaves a syntax error, a missing import or a renamed symbol makes\nalmost any test fail, and that failure says nothing about whether the test checks the behaviour.\nThe failure should be the assertion that names the behaviour the fix restored: the expected value,\nthe refused input, the row that should not be written.</p>\n<p>If the check passes with the fix broken, the check is not guarding the fix. Rewrite it until it\nfails, or record that the fix is unguarded and why.</p>\n<h3 id=\"why-not-version-control\">Why not version control</h3>\n<p><code>git checkout -- &lt;file&gt;</code>, <code>git restore &lt;file&gt;</code> and <code>git stash</code> all put back the last committed\nversion of the file. The fix being armed is usually uncommitted, in that same file, so each of them\nremoves the mutation and the fix together. Nothing reports it: the command exits zero and prints\nnothing. The next test run passes too, either because the fix&#39;s own test went with it or because\nnothing else calls the code. The only sign is the fix&#39;s absence, and nobody looks for an absence\nafter a green run. That is why step 5 checks content, not test results.</p>\n<p>The byte copy has one more advantage: it restores exactly the state you armed, including other\nuncommitted edits in the file that belong to the same round.</p>\n<h3 id=\"checks-that-are-not-tests\">Checks that are not tests</h3>\n<p>Not every fix lives in code a test can reach. A data correction, a configuration value or a\ndocument can be armed the same way with a self-check: a script, query or assertion that reads the\nartefact and fails when the fix is absent. Break the artefact from a byte copy, watch the self-check\nfail, restore, watch it pass.</p>\n<h3 id=\"arming-the-other-side\">Arming the other side</h3>\n<p>Some checks compare two things: code against a seed file, a registry against what it registers, a\nmanifest against the files it lists. Mutating one side proves the check notices that side moving.\nIt proves nothing about the other side. Arm both: break the code and watch it fail; restore; break\nthe data and watch it fail; restore.</p>\n","words":564},{"path":"references/merge-preconditions.md","slug":"merge-preconditions","title":"Merge preconditions","body":"# Merge preconditions\n\nThe review was of one commit. The merge must be of that commit, into the branch it was meant for,\nwith every finding of the round answered and every required check having run on it. Each section\nbelow is one line of the merge checklist in step 14, and why it is there. Each has failed in\npractice while every dashboard looked green.\n\nA person runs the checklist and the merge. This skill once shipped a script that tested these lines\nand then merged, and three review rounds running each found a new way for it to merge something\nnobody had reviewed: findings not yet read, a base that had moved, a reused round number, a head\nreviewed again until a run came back clean. The checks below are the same; what changed is that\nnothing merges until a person has looked at each one.\n\n## 1. The pull request's head is the reviewed head\n\n```bash\ngh pr view <pr> --json headRefOid --jq .headRefOid   # must equal round-<n>.head\n```\n\nIt must equal the head the final round reviewed. A fix pushed after that round — however small — is\nunreviewed code, and either gets its own round or does not merge.\n\n## 2. No earlier round that did not end the loop reviewed that head\n\nA review is a sample, not a proof: the same head can be graded P1 on one run and only P3 on the\nnext. A head that a round graded above the lowest grade is fixed, and the fix is a new head, which\nis what the next round reviews. Running the review again on the unchanged head until a run comes\nback clean merges a defect a round already found. The one exception is a round whose every finding\nabove the lowest grade was rejected with evidence: nothing was there to fix.\n\n```bash\ngrep -lx '<reviewed sha>' \"$REVIEW_LOGS\"/round-*.head   # any file but the final round's is a stop\n```\n\n## 3. Every finding of the final round has a complete disposition\n\nEach graded finding has its line in `round-<n>.dispositions` — the finding as the reviewer wrote it,\nthen `=> deferred: <reason>, tracked in <where>` or `=> rejected: <evidence>`, every part present —\nand a review that graded nothing was recorded `clean:` by the person who read it\n([the dispositions file](review-record.md#the-dispositions-file)). A finding with no line, or a\nline missing its tracker or its evidence, is a finding nobody has answered.\n\n## 4. The base has not moved since the review\n\nThe reviewer diffed the head against one commit of the base. If the base branch advances after the\nreview, the merge lands on code the reviewer never saw, and nothing about the head says so: it still\nmatches, it can still read `MERGEABLE`, and in a repository that does not require branches to be up\nto date its checks stay green. So the round records the base sha it reviewed against — the tip of\n`origin/main` right after its fetch — and that is compared with the branch's tip now:\n\n```bash\ngit ls-remote origin refs/heads/<base> | cut -f1   # must equal the base sha the round recorded\n```\n\nDo not read it from the pull request. `baseRefOid` is the base as of the head's last push, not the\nbranch's tip, measured: an open pull request reported a `baseRefOid` 17 commits behind its base\nbranch, while it read `MERGEABLE` and GitHub's own test merge was built on the branch's real tip. A\ncheck that compares `baseRefOid` with the recorded base passes after the base has moved.\n\nA base that moved means review again, on a fresh round, not merge. Nothing pins the base at the\nmerge the way `--match-head-commit` pins the head, so the check leaves the seconds between it and\nthe merge open; a branch rule that requires branches to be up to date before merging closes them.\n\n## 5. It lands on the branch it should, and it is mergeable\n\n```bash\ngh pr view <pr> --json baseRefName,mergeable,mergeStateStatus\n```\n\nA stacked pull request targets another feature branch. When that branch merges and is deleted, the\nstacked pull request can still be merged, and GitHub reports it merged — into a branch that no\nlonger goes anywhere. Retarget it to the real base first (`gh pr edit <pr> --base <base>`), let its\nchecks run on the new merge, and review the new diff, which may now conflict or contain commits it\ndid not before. Verify that it landed by content — the merged files on the base match the reviewed\nones — and not by a count of commits.\n\nA pull-request workflow runs against a test merge of the head into the base. When the pull request\nconflicts with its base, that merge cannot be built, and **no pull-request run is dispatched at\nall** — no queued run, no failure, nothing. It looks exactly like a slow or broken queue. When a\npull request gets no runs while others do, read `mergeable` before anything else; `CONFLICTING`\nis the answer more often than an outage is.\n\n## 6. Every required check ran and passed on that exact commit\n\nThe required checks pass only as a zero exit, a non-empty list, and every check passed.\nHow the GitHub CLI reports them, measured rather than assumed:\n\n| Call | What it does when… |\n|---|---|\n| `gh pr checks <pr>` (no `--json`) | a check failed: exits 1; checks pending: exits 8 |\n| `gh pr checks <pr> --json name,bucket` | a check failed: **exits 0**, with `\"bucket\": \"fail\"` in the list |\n| `gh pr checks <pr> --required …` | the repository declares no required checks: exits 1, \"no required checks reported\" |\n\nSo the exit code alone cannot gate the JSON form, and an empty list is not a pass. Read the buckets:\n\n```bash\ngh pr checks <pr> --required --json bucket --jq 'length > 0 and all(.[]; .bucket == \"pass\")'\n```\n\nIt must exit zero and print `true`. A repository that declares no required checks fails this line,\nand that is correct: nobody has said which checks matter, so nothing has shown them passing. Name\nthe checks that must pass, and test each of them by name instead:\n\n```bash\ngh pr checks <pr> --json name,bucket --jq '[.[] | select(.name == \"<check>\")] | length == 1 and all(.[]; .bucket == \"pass\")'\n```\n\nTo be sure the answer is about the reviewed commit and not an older head, ask about the sha itself:\n\n```bash\ngh api \"repos/<owner>/<repo>/commits/<sha>/check-runs\" \\\n  --jq '.check_runs[] | [.name, .status, .conclusion] | @tsv'\n```\n\nA required check that is missing has not passed; it has not run. A check that ran on an earlier\nhead says nothing about this one.\n\n## 7. Nothing in the diff told the reviewer what to say\n\nA reviewer reads instructions and configuration from the tree it runs in, and the round runs it in a\nworktree at the pull request's head. A pull request that adds or edits such a file hands the reviewer\ninstructions nobody has reviewed: one line can tell it to grade everything P3. Filtering the diff for\nthe files that matter does not converge. Every filter tried here missed another way in: a configured\nfallback name, a symbolic link whose target changed, a setting that names another file, a name with a\nspace in it. So the channel is cut instead.\n\n**Run the reviewer so that it takes nothing from the tree.** For Codex, read from its source at\n`openai/codex@fbb2f9d`:\n\n- Its project instruction files — `AGENTS.override.md`, `AGENTS.md` and each\n  `project_doc_fallback_filenames` name (`codex-rs/core/src/agents_md.rs:272-296`) — are read only\n  while `project_doc_max_bytes` is above zero; at zero, none is (`agents_md.rs:68-72`, `:133-135`). A\n  `-c` flag is a session layer, which outranks a project's (`codex-rs/config/src/config_layer_source.rs:46-47`),\n  so nothing in the tree can raise it again. The user's own instructions, in `$CODEX_HOME`, still apply.\n- A `.codex/` directory between the project root and where it runs is a configuration layer of its\n  own (`codex-rs/config/src/loader/mod.rs:1705-1725`). It can set `model_instructions_file`\n  (`codex-rs/config/src/config_toml.rs:275`), which is not among the keys Codex strips from a project\n  layer (`loader/mod.rs:89-102`), and no flag turns the layer off.\n- A `.agents/skills/` directory there is read as a root of skills\n  (`codex-rs/ext/skills/src/host_roots.rs:24-25`, `:137-185`).\n\nSo the recipe runs `codex exec review -c project_doc_max_bytes=0` from the root of the tree, which is\nalso its project root (its `.git` is the default marker), and `review_round` refuses a tree that holds\n`.codex` or `.agents` there, before the reviewer starts. A round run that way took no instructions\nfrom the tree, and this line holds with nothing more to read. Check these facts again against the\nCodex you run when its version changes.\n\n**When the reviewer cannot be told to ignore the tree** — another reviewer, a tree the round refused,\na Codex that no longer works this way — a person reads every change the diff makes to a file any\nreviewer could take as instructions or configuration, every symbolic link it adds, changes or\nremoves, and every configuration file the reviewer reads, and records that in the round's record. No\nlist of names decides what is read: every file the diff touches is listed, and the person judges each.\n\n```bash\ngit diff --name-status --no-renames <recorded base>...<reviewed sha>   # every file the diff touches\ngit diff --raw --no-renames <recorded base>...<reviewed sha> | grep -E '^:(120000 [0-7]{6}|[0-7]{6} 120000) '   # every symbolic link\n```\n\n## The merge\n\nWhen every line has held, merge with the head pinned:\n\n```bash\ngh pr merge <pr> --merge --match-head-commit <reviewed sha>\n```\n\n`--match-head-commit` makes the merge fail if the head moved after the checklist: a push from another\nsession, a bot's commit, an accidental force-push. Without it, the merge takes whatever the head is\nat that moment. Use the repository's merge method; the checklist and the pin are what matter.\n\n## After the merge\n\nConfirm that what landed is what was reviewed: with `--merge`, the merge commit's second parent is\nthe reviewed head.\n\n```bash\ngit fetch origin\nmerge=$(gh pr view <pr> --json mergeCommit --jq .mergeCommit.oid)\n[ \"$(git rev-parse \"$merge^2\")\" = \"<reviewed sha>\" ] && echo \"merged the reviewed head\"\n```\n\nDo not compare the merged files with the reviewed head's. When the base changed one of the same\nfiles on another line, a correct merge carries both changes and that comparison reports a\ndifference. A squash or rebase merge has no second parent; check those by the pull request's own\nrecord of the commit it merged.\n","bodyHtml":"<h2 id=\"merge-preconditions\">Merge preconditions</h2>\n<p>The review was of one commit. The merge must be of that commit, into the branch it was meant for,\nwith every finding of the round answered and every required check having run on it. Each section\nbelow is one line of the merge checklist in step 14, and why it is there. Each has failed in\npractice while every dashboard looked green.</p>\n<p>A person runs the checklist and the merge. This skill once shipped a script that tested these lines\nand then merged, and three review rounds running each found a new way for it to merge something\nnobody had reviewed: findings not yet read, a base that had moved, a reused round number, a head\nreviewed again until a run came back clean. The checks below are the same; what changed is that\nnothing merges until a person has looked at each one.</p>\n<h3 id=\"1-the-pull-requests-head-is-the-reviewed-head\">1. The pull request&#39;s head is the reviewed head</h3>\n<pre><code class=\"language-bash\">gh pr view &lt;pr&gt; --json headRefOid --jq .headRefOid   # must equal round-&lt;n&gt;.head\n</code></pre>\n<p>It must equal the head the final round reviewed. A fix pushed after that round — however small — is\nunreviewed code, and either gets its own round or does not merge.</p>\n<h3 id=\"2-no-earlier-round-that-did-not-end-the-loop-reviewed-that-head\">2. No earlier round that did not end the loop reviewed that head</h3>\n<p>A review is a sample, not a proof: the same head can be graded P1 on one run and only P3 on the\nnext. A head that a round graded above the lowest grade is fixed, and the fix is a new head, which\nis what the next round reviews. Running the review again on the unchanged head until a run comes\nback clean merges a defect a round already found. The one exception is a round whose every finding\nabove the lowest grade was rejected with evidence: nothing was there to fix.</p>\n<pre><code class=\"language-bash\">grep -lx &#39;&lt;reviewed sha&gt;&#39; &quot;$REVIEW_LOGS&quot;/round-*.head   # any file but the final round&#39;s is a stop\n</code></pre>\n<h3 id=\"3-every-finding-of-the-final-round-has-a-complete-disposition\">3. Every finding of the final round has a complete disposition</h3>\n<p>Each graded finding has its line in <code>round-&lt;n&gt;.dispositions</code> — the finding as the reviewer wrote it,\nthen <code>=&gt; deferred: &lt;reason&gt;, tracked in &lt;where&gt;</code> or <code>=&gt; rejected: &lt;evidence&gt;</code>, every part present —\nand a review that graded nothing was recorded <code>clean:</code> by the person who read it\n(<a href=\"review-record.md#the-dispositions-file\">the dispositions file</a>). A finding with no line, or a\nline missing its tracker or its evidence, is a finding nobody has answered.</p>\n<h3 id=\"4-the-base-has-not-moved-since-the-review\">4. The base has not moved since the review</h3>\n<p>The reviewer diffed the head against one commit of the base. If the base branch advances after the\nreview, the merge lands on code the reviewer never saw, and nothing about the head says so: it still\nmatches, it can still read <code>MERGEABLE</code>, and in a repository that does not require branches to be up\nto date its checks stay green. So the round records the base sha it reviewed against — the tip of\n<code>origin/main</code> right after its fetch — and that is compared with the branch&#39;s tip now:</p>\n<pre><code class=\"language-bash\">git ls-remote origin refs/heads/&lt;base&gt; | cut -f1   # must equal the base sha the round recorded\n</code></pre>\n<p>Do not read it from the pull request. <code>baseRefOid</code> is the base as of the head&#39;s last push, not the\nbranch&#39;s tip, measured: an open pull request reported a <code>baseRefOid</code> 17 commits behind its base\nbranch, while it read <code>MERGEABLE</code> and GitHub&#39;s own test merge was built on the branch&#39;s real tip. A\ncheck that compares <code>baseRefOid</code> with the recorded base passes after the base has moved.</p>\n<p>A base that moved means review again, on a fresh round, not merge. Nothing pins the base at the\nmerge the way <code>--match-head-commit</code> pins the head, so the check leaves the seconds between it and\nthe merge open; a branch rule that requires branches to be up to date before merging closes them.</p>\n<h3 id=\"5-it-lands-on-the-branch-it-should-and-it-is-mergeable\">5. It lands on the branch it should, and it is mergeable</h3>\n<pre><code class=\"language-bash\">gh pr view &lt;pr&gt; --json baseRefName,mergeable,mergeStateStatus\n</code></pre>\n<p>A stacked pull request targets another feature branch. When that branch merges and is deleted, the\nstacked pull request can still be merged, and GitHub reports it merged — into a branch that no\nlonger goes anywhere. Retarget it to the real base first (<code>gh pr edit &lt;pr&gt; --base &lt;base&gt;</code>), let its\nchecks run on the new merge, and review the new diff, which may now conflict or contain commits it\ndid not before. Verify that it landed by content — the merged files on the base match the reviewed\nones — and not by a count of commits.</p>\n<p>A pull-request workflow runs against a test merge of the head into the base. When the pull request\nconflicts with its base, that merge cannot be built, and <strong>no pull-request run is dispatched at\nall</strong> — no queued run, no failure, nothing. It looks exactly like a slow or broken queue. When a\npull request gets no runs while others do, read <code>mergeable</code> before anything else; <code>CONFLICTING</code>\nis the answer more often than an outage is.</p>\n<h3 id=\"6-every-required-check-ran-and-passed-on-that-exact-commit\">6. Every required check ran and passed on that exact commit</h3>\n<p>The required checks pass only as a zero exit, a non-empty list, and every check passed.\nHow the GitHub CLI reports them, measured rather than assumed:</p>\n<table>\n<thead>\n<tr>\n<th>Call</th>\n<th>What it does when…</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>gh pr checks &lt;pr&gt;</code> (no <code>--json</code>)</td>\n<td>a check failed: exits 1; checks pending: exits 8</td>\n</tr>\n<tr>\n<td><code>gh pr checks &lt;pr&gt; --json name,bucket</code></td>\n<td>a check failed: <strong>exits 0</strong>, with <code>&quot;bucket&quot;: &quot;fail&quot;</code> in the list</td>\n</tr>\n<tr>\n<td><code>gh pr checks &lt;pr&gt; --required …</code></td>\n<td>the repository declares no required checks: exits 1, &quot;no required checks reported&quot;</td>\n</tr>\n</tbody></table>\n<p>So the exit code alone cannot gate the JSON form, and an empty list is not a pass. Read the buckets:</p>\n<pre><code class=\"language-bash\">gh pr checks &lt;pr&gt; --required --json bucket --jq &#39;length &gt; 0 and all(.[]; .bucket == &quot;pass&quot;)&#39;\n</code></pre>\n<p>It must exit zero and print <code>true</code>. A repository that declares no required checks fails this line,\nand that is correct: nobody has said which checks matter, so nothing has shown them passing. Name\nthe checks that must pass, and test each of them by name instead:</p>\n<pre><code class=\"language-bash\">gh pr checks &lt;pr&gt; --json name,bucket --jq &#39;[.[] | select(.name == &quot;&lt;check&gt;&quot;)] | length == 1 and all(.[]; .bucket == &quot;pass&quot;)&#39;\n</code></pre>\n<p>To be sure the answer is about the reviewed commit and not an older head, ask about the sha itself:</p>\n<pre><code class=\"language-bash\">gh api &quot;repos/&lt;owner&gt;/&lt;repo&gt;/commits/&lt;sha&gt;/check-runs&quot; \\\n  --jq &#39;.check_runs[] | [.name, .status, .conclusion] | @tsv&#39;\n</code></pre>\n<p>A required check that is missing has not passed; it has not run. A check that ran on an earlier\nhead says nothing about this one.</p>\n<h3 id=\"7-nothing-in-the-diff-told-the-reviewer-what-to-say\">7. Nothing in the diff told the reviewer what to say</h3>\n<p>A reviewer reads instructions and configuration from the tree it runs in, and the round runs it in a\nworktree at the pull request&#39;s head. A pull request that adds or edits such a file hands the reviewer\ninstructions nobody has reviewed: one line can tell it to grade everything P3. Filtering the diff for\nthe files that matter does not converge. Every filter tried here missed another way in: a configured\nfallback name, a symbolic link whose target changed, a setting that names another file, a name with a\nspace in it. So the channel is cut instead.</p>\n<p><strong>Run the reviewer so that it takes nothing from the tree.</strong> For Codex, read from its source at\n<code>openai/codex@fbb2f9d</code>:</p>\n<ul>\n<li>Its project instruction files — <code>AGENTS.override.md</code>, <code>AGENTS.md</code> and each\n<code>project_doc_fallback_filenames</code> name (<code>codex-rs/core/src/agents_md.rs:272-296</code>) — are read only\nwhile <code>project_doc_max_bytes</code> is above zero; at zero, none is (<code>agents_md.rs:68-72</code>, <code>:133-135</code>). A\n<code>-c</code> flag is a session layer, which outranks a project&#39;s (<code>codex-rs/config/src/config_layer_source.rs:46-47</code>),\nso nothing in the tree can raise it again. The user&#39;s own instructions, in <code>$CODEX_HOME</code>, still apply.</li>\n<li>A <code>.codex/</code> directory between the project root and where it runs is a configuration layer of its\nown (<code>codex-rs/config/src/loader/mod.rs:1705-1725</code>). It can set <code>model_instructions_file</code>\n(<code>codex-rs/config/src/config_toml.rs:275</code>), which is not among the keys Codex strips from a project\nlayer (<code>loader/mod.rs:89-102</code>), and no flag turns the layer off.</li>\n<li>A <code>.agents/skills/</code> directory there is read as a root of skills\n(<code>codex-rs/ext/skills/src/host_roots.rs:24-25</code>, <code>:137-185</code>).</li>\n</ul>\n<p>So the recipe runs <code>codex exec review -c project_doc_max_bytes=0</code> from the root of the tree, which is\nalso its project root (its <code>.git</code> is the default marker), and <code>review_round</code> refuses a tree that holds\n<code>.codex</code> or <code>.agents</code> there, before the reviewer starts. A round run that way took no instructions\nfrom the tree, and this line holds with nothing more to read. Check these facts again against the\nCodex you run when its version changes.</p>\n<p><strong>When the reviewer cannot be told to ignore the tree</strong> — another reviewer, a tree the round refused,\na Codex that no longer works this way — a person reads every change the diff makes to a file any\nreviewer could take as instructions or configuration, every symbolic link it adds, changes or\nremoves, and every configuration file the reviewer reads, and records that in the round&#39;s record. No\nlist of names decides what is read: every file the diff touches is listed, and the person judges each.</p>\n<pre><code class=\"language-bash\">git diff --name-status --no-renames &lt;recorded base&gt;...&lt;reviewed sha&gt;   # every file the diff touches\ngit diff --raw --no-renames &lt;recorded base&gt;...&lt;reviewed sha&gt; | grep -E &#39;^:(120000 [0-7]{6}|[0-7]{6} 120000) &#39;   # every symbolic link\n</code></pre>\n<h3 id=\"the-merge\">The merge</h3>\n<p>When every line has held, merge with the head pinned:</p>\n<pre><code class=\"language-bash\">gh pr merge &lt;pr&gt; --merge --match-head-commit &lt;reviewed sha&gt;\n</code></pre>\n<p><code>--match-head-commit</code> makes the merge fail if the head moved after the checklist: a push from another\nsession, a bot&#39;s commit, an accidental force-push. Without it, the merge takes whatever the head is\nat that moment. Use the repository&#39;s merge method; the checklist and the pin are what matter.</p>\n<h3 id=\"after-the-merge\">After the merge</h3>\n<p>Confirm that what landed is what was reviewed: with <code>--merge</code>, the merge commit&#39;s second parent is\nthe reviewed head.</p>\n<pre><code class=\"language-bash\">git fetch origin\nmerge=$(gh pr view &lt;pr&gt; --json mergeCommit --jq .mergeCommit.oid)\n[ &quot;$(git rev-parse &quot;$merge^2&quot;)&quot; = &quot;&lt;reviewed sha&gt;&quot; ] &amp;&amp; echo &quot;merged the reviewed head&quot;\n</code></pre>\n<p>Do not compare the merged files with the reviewed head&#39;s. When the base changed one of the same\nfiles on another line, a correct merge carries both changes and that comparison reports a\ndifference. A squash or rebase merge has no second parent; check those by the pull request&#39;s own\nrecord of the commit it merged.</p>\n","words":1737},{"path":"references/review-record.md","slug":"review-record","title":"The review record","body":"# The review record\n\nOne record per round. It is what lets a reader who saw none of the rounds tell which findings were\nreal, what was done about each, how each fix was proven to matter, and what it changed.\n\n## Where it goes\n\nOn the pull request, as a comment or a section of its description. That is the one place a record\ncan name every commit it refers to without moving the head under review.\n\nA repository that keeps records as files commits each one **after** the fixes it describes, never\ntogether with them. A file cannot name the commit that adds it: that sha does not exist until the\nfile is committed, and writing it in afterwards changes the file and so the sha. Committed after the\nfixes, the record names them, and the next round reviews it along with them. The last round's\nrecord still goes on the pull request: a record committed after the last review would itself be a\nhead nobody reviewed.\n\n## Taking the final review\n\nA reviewer's log is not its review. Before the final review it prints the work it did on the way:\ndrafts, commands it ran, files it read — including old review records or logs it found in the\nrepository, which it may quote at length. The review is its final message, and it has to be taken\nfrom a boundary nothing in the log can fake.\n\n**Where the reviewer writes its final message to a file, use that file.** The Codex CLI's exec form\ndoes — `codex exec review --base <base sha> -o <file>` writes the final message, and only that,\nto the file, while the log goes to standard output as usual. Observed: on a scratch repository whose\nchange contained a line reading exactly `codex`, the log held that marker line and the `-o` file\nheld the review alone, finding included. Remove the file before the round starts, so a file from an\nearlier round can never stand in for this one.\n\n**Where the reviewer only prints a log, cutting by a marker is a fallback with a known flaw.** With\nthe Codex CLI's log, every message opens with a line reading `codex`, and the final block is\neverything after the last such line:\n\n```bash\nawk '/^codex$/{buf=\"\"} {buf=buf $0 \"\\n\"} END{printf \"%s\", buf}' \"$REVIEW_LOGS/round-3.log\" > \"$REVIEW_LOGS/round-3.final.txt\"\ngrep -c '^codex$' \"$REVIEW_LOGS/round-3.log\"   # how many blocks there were; all but the last are discarded\n```\n\nThe flaw: a line that equals the marker inside quoted output — a file the review shows, a command's\noutput — restarts the cut there. The findings before it vanish, and what is left still looks like a\nreview. So count the markers, compare the cut block with the log by eye, and treat any cut that\nstarts inside quoted text as a failed extraction. An extraction that takes the first block, or\neverything, fails the other way: it presents earlier rounds' findings as this one's.\n\nKeep raw logs outside the repository. A log committed in round 2 is a file the reviewer can read and\nquote in round 3.\n\n## A failed round is not a clean round\n\nA round counts only when two things are true: the reviewer exited zero, and its final review is\nnon-empty. A reviewer that crashed, timed out, hit a rate limit or was logged out leaves no final\nreview, or an empty one — and nothing reads exactly like a review that found nothing. Test both\nbefore reading a single finding:\n\n```bash\n# The same log directory as the main recipe: absolute, and outside the tree under review.\n: \"${REVIEW_LOGS:?set REVIEW_LOGS to an absolute directory outside the repository}\"\ncase \"$REVIEW_LOGS\" in /*) ;; *) echo \"REFUSE: REVIEW_LOGS must be an absolute path\"; exit 1;; esac\nfinal=\"$REVIEW_LOGS/round-3.final.txt\"\nrm -f \"$final\"\nbase=$(git rev-parse origin/main)   # recorded once; the reviewer gets this sha, never the name to resolve\ncodex exec review -c project_doc_max_bytes=0 --base \"$base\" -o \"$final\" > \"$REVIEW_LOGS/round-3.log\" 2>&1 &\nwait $! || echo \"ROUND FAILED: the reviewer exited non-zero\"\ngrep -q '[^[:space:]]' \"$final\" 2>/dev/null || echo \"ROUND FAILED: no final review was written\"\n```\n\nThe skill's `review_round` does all of this, refuses a log directory inside the tree under review\nor any worktree of the checkout, refuses a base that is not a sha, refuses a tree holding `.codex`\nor `.agents`, and removes the final review of a round that failed, so no later step can read one.\nCodex resolves `--base` with\n`git rev-parse --verify` when the review starts, and for a branch with an upstream that is ahead it\ntakes the upstream instead (read from its source). A sha resolves to itself and has no upstream, so\nthe diff is taken from the merge base of the head and the commit the round recorded.\n\nA failed round is recorded as failed, with the reason, and run again as a new round. It never stops\nthe loop. A round number is never reused: the review step reserves it atomically and refuses one\nthat is taken, by a run that finished or one still going, so a final review or dispositions left by\nan earlier run can never be read against a later head.\n\n## Another reviewer\n\nFor another reviewer, find the equivalent: an option that writes its final message to a file, a\nmachine-readable output mode, or, last, the marker its final message carries. Check whichever it is\non a log you have read by eye before trusting it, and record in each round how the final review was\ntaken.\n\n## Fields\n\n```text\nReview round <n> — PR <number> — head <sha> against <base>\nReviewer: <exact command>; final review from <the -o file | a marker cut: <k> markers, checked by eye>\n\n[<severity>] <title, as the reviewer wrote it>\n  verified:    yes — <file>:<line>; <the input that reproduces it>\n               | no — <the evidence that refutes it>\n  disposition: fixed in <sha> | fixed (cheap) in <sha> | deferred: <reason>, tracked in <where>\n               | rejected: see verified | duplicate of round <m> [<severity>] <title>\n  armed:       <the check> failed with the fix broken by <mutation>; passed after a restore\n               from a byte copy, checked with <cmp | grep for identifier>\n  effect:      <numbers that moved, from -> to, by <command>> | none — <command> output identical\n\nTests:       <command> at <sha of the last fix commit> — <result>\nReproduce:   <command> at <sha of the last fix commit> — <result>\nCorrections: <anything an earlier record got wrong, stated here>\nNext:        round <n+1> on the pushed head\n             | stop, defer and merge <sha this round reviewed>\n             | stop, fix and confirm: one confirmation round on the pushed head\n             | split proposed: <link>\n```\n\nEvery finding in the final block appears, including the ones that were rejected. A record that lists\nonly the findings acted on hides the reviewer's error rate, which is the number the next reader needs\nin order to know how far to trust the reviewer.\n\n## Dispositions\n\n- **fixed** — verified, fixed, armed, effect measured.\n- **fixed (cheap)** — a lowest-severity finding fixed because fixing it cost less than recording it.\n  It still gets its effect line. In the round that stops the loop, a cheap fix makes a new head, and\n  that head merges only after one confirmation round has reviewed it; findings that confirmation\n  round reports at the lowest severity are deferred, not fixed.\n- **deferred** — verified and real, not fixed in this pull request. The reason is stated and the\n  place it is tracked is named. **Only a lowest-severity finding can be deferred.** A finding above\n  it is fixed or rejected with evidence. An owner who disputes its grade re-scores it explicitly,\n  with the reason in the record — and until it is fixed, or re-scored and graded no higher by a\n  later round's final review, it blocks the stop rule and the merge.\n- **rejected** — the claim does not hold. The evidence is recorded: the line that shows it, and the\n  input that behaves correctly. A rejection without evidence is a disagreement, not a disposition.\n- **duplicate** — the same defect as an earlier finding, perhaps worded differently or graded\n  differently. Name the earlier one and its state.\n\n## The dispositions file\n\nLine 3 of the merge checklist (step 14) does not take the record's word for it; it reads the\ndispositions of the round that merges from a file beside that round's final review,\n`round-<n>.dispositions` in the log directory, written after the findings were read and verified.\nOne line per graded finding of the final review: the finding's first line exactly as the reviewer\nwrote it, less a leading `- `, then ` => `, then its disposition.\n\n```text\n[P3] Log line misspells an arm label — src/report.py:41-41 => deferred: cosmetic, tracked in #212\n[P3] Retry delay is not jittered — src/fetch.py:88-90 => rejected: jitter is applied in the caller, src/client.py:17\n```\n\nA finding with no line blocks the merge; so does a line with any disposition but `deferred` or\n`rejected`, because a finding fixed in the stop round makes a new head, which merges only after its\nown confirmation round. Each line is read whole: it starts with the finding, a deferral names\nboth its reason and `tracked in <where>`, and a rejection carries its evidence. A bare\n`deferred: cosmetic` or an empty `rejected:` blocks the merge as a missing line does. The review\nstep reserves each round number atomically, refuses one that is taken, and pins the round only once\nits review succeeded, so neither dispositions nor a final review from an earlier run stand in for\nthis one.\n\nA final review that grades no finding at all is not clean on its face. A clean Codex review is\nplain prose — its overall verdict, with no grade and no fixed wording (seen in a Codex session's own\nrecord of a clean review) — and so is a reviewer's error message, or a half-written reply. Only the\nperson who read it can tell them apart, so such a round counts as failed unless the file says\nso in a line of its own, `clean: <the reviewer's verdict, quoted>`.\n\n## Measuring an effect\n\n\"Effect\" means what the fix changed outside the code: a published number, an output a user sees, a\nrow written to a store. Where the pull request publishes numbers, measure it.\n\n1. Run the reproduce script, or the command that produces the published output, on the commit\n   before the fix. Keep its outputs.\n2. Run it on the commit with the fix.\n3. Diff the two. Every changed number goes in the effect line, from what to what.\n\n\"None\" is a result of that diff, not a judgement about the fix. Write it with the command that\nproduced the identical outputs. Where nothing is published, the effect is the behaviour that changed:\nname the test that now passes and what it asserts.\n\nA finding whose fix moves a published number is also a correction to what was published. Record it\nwhere the published numbers live as well — in the study's addendum or the report's corrections —\nand not only in the review record.\n","bodyHtml":"<h2 id=\"the-review-record\">The review record</h2>\n<p>One record per round. It is what lets a reader who saw none of the rounds tell which findings were\nreal, what was done about each, how each fix was proven to matter, and what it changed.</p>\n<h3 id=\"where-it-goes\">Where it goes</h3>\n<p>On the pull request, as a comment or a section of its description. That is the one place a record\ncan name every commit it refers to without moving the head under review.</p>\n<p>A repository that keeps records as files commits each one <strong>after</strong> the fixes it describes, never\ntogether with them. A file cannot name the commit that adds it: that sha does not exist until the\nfile is committed, and writing it in afterwards changes the file and so the sha. Committed after the\nfixes, the record names them, and the next round reviews it along with them. The last round&#39;s\nrecord still goes on the pull request: a record committed after the last review would itself be a\nhead nobody reviewed.</p>\n<h3 id=\"taking-the-final-review\">Taking the final review</h3>\n<p>A reviewer&#39;s log is not its review. Before the final review it prints the work it did on the way:\ndrafts, commands it ran, files it read — including old review records or logs it found in the\nrepository, which it may quote at length. The review is its final message, and it has to be taken\nfrom a boundary nothing in the log can fake.</p>\n<p><strong>Where the reviewer writes its final message to a file, use that file.</strong> The Codex CLI&#39;s exec form\ndoes — <code>codex exec review --base &lt;base sha&gt; -o &lt;file&gt;</code> writes the final message, and only that,\nto the file, while the log goes to standard output as usual. Observed: on a scratch repository whose\nchange contained a line reading exactly <code>codex</code>, the log held that marker line and the <code>-o</code> file\nheld the review alone, finding included. Remove the file before the round starts, so a file from an\nearlier round can never stand in for this one.</p>\n<p><strong>Where the reviewer only prints a log, cutting by a marker is a fallback with a known flaw.</strong> With\nthe Codex CLI&#39;s log, every message opens with a line reading <code>codex</code>, and the final block is\neverything after the last such line:</p>\n<pre><code class=\"language-bash\">awk &#39;/^codex$/{buf=&quot;&quot;} {buf=buf $0 &quot;\\n&quot;} END{printf &quot;%s&quot;, buf}&#39; &quot;$REVIEW_LOGS/round-3.log&quot; &gt; &quot;$REVIEW_LOGS/round-3.final.txt&quot;\ngrep -c &#39;^codex$&#39; &quot;$REVIEW_LOGS/round-3.log&quot;   # how many blocks there were; all but the last are discarded\n</code></pre>\n<p>The flaw: a line that equals the marker inside quoted output — a file the review shows, a command&#39;s\noutput — restarts the cut there. The findings before it vanish, and what is left still looks like a\nreview. So count the markers, compare the cut block with the log by eye, and treat any cut that\nstarts inside quoted text as a failed extraction. An extraction that takes the first block, or\neverything, fails the other way: it presents earlier rounds&#39; findings as this one&#39;s.</p>\n<p>Keep raw logs outside the repository. A log committed in round 2 is a file the reviewer can read and\nquote in round 3.</p>\n<h3 id=\"a-failed-round-is-not-a-clean-round\">A failed round is not a clean round</h3>\n<p>A round counts only when two things are true: the reviewer exited zero, and its final review is\nnon-empty. A reviewer that crashed, timed out, hit a rate limit or was logged out leaves no final\nreview, or an empty one — and nothing reads exactly like a review that found nothing. Test both\nbefore reading a single finding:</p>\n<pre><code class=\"language-bash\"># The same log directory as the main recipe: absolute, and outside the tree under review.\n: &quot;${REVIEW_LOGS:?set REVIEW_LOGS to an absolute directory outside the repository}&quot;\ncase &quot;$REVIEW_LOGS&quot; in /*) ;; *) echo &quot;REFUSE: REVIEW_LOGS must be an absolute path&quot;; exit 1;; esac\nfinal=&quot;$REVIEW_LOGS/round-3.final.txt&quot;\nrm -f &quot;$final&quot;\nbase=$(git rev-parse origin/main)   # recorded once; the reviewer gets this sha, never the name to resolve\ncodex exec review -c project_doc_max_bytes=0 --base &quot;$base&quot; -o &quot;$final&quot; &gt; &quot;$REVIEW_LOGS/round-3.log&quot; 2&gt;&amp;1 &amp;\nwait $! || echo &quot;ROUND FAILED: the reviewer exited non-zero&quot;\ngrep -q &#39;[^[:space:]]&#39; &quot;$final&quot; 2&gt;/dev/null || echo &quot;ROUND FAILED: no final review was written&quot;\n</code></pre>\n<p>The skill&#39;s <code>review_round</code> does all of this, refuses a log directory inside the tree under review\nor any worktree of the checkout, refuses a base that is not a sha, refuses a tree holding <code>.codex</code>\nor <code>.agents</code>, and removes the final review of a round that failed, so no later step can read one.\nCodex resolves <code>--base</code> with\n<code>git rev-parse --verify</code> when the review starts, and for a branch with an upstream that is ahead it\ntakes the upstream instead (read from its source). A sha resolves to itself and has no upstream, so\nthe diff is taken from the merge base of the head and the commit the round recorded.</p>\n<p>A failed round is recorded as failed, with the reason, and run again as a new round. It never stops\nthe loop. A round number is never reused: the review step reserves it atomically and refuses one\nthat is taken, by a run that finished or one still going, so a final review or dispositions left by\nan earlier run can never be read against a later head.</p>\n<h3 id=\"another-reviewer\">Another reviewer</h3>\n<p>For another reviewer, find the equivalent: an option that writes its final message to a file, a\nmachine-readable output mode, or, last, the marker its final message carries. Check whichever it is\non a log you have read by eye before trusting it, and record in each round how the final review was\ntaken.</p>\n<h3 id=\"fields\">Fields</h3>\n<pre><code class=\"language-text\">Review round &lt;n&gt; — PR &lt;number&gt; — head &lt;sha&gt; against &lt;base&gt;\nReviewer: &lt;exact command&gt;; final review from &lt;the -o file | a marker cut: &lt;k&gt; markers, checked by eye&gt;\n\n[&lt;severity&gt;] &lt;title, as the reviewer wrote it&gt;\n  verified:    yes — &lt;file&gt;:&lt;line&gt;; &lt;the input that reproduces it&gt;\n               | no — &lt;the evidence that refutes it&gt;\n  disposition: fixed in &lt;sha&gt; | fixed (cheap) in &lt;sha&gt; | deferred: &lt;reason&gt;, tracked in &lt;where&gt;\n               | rejected: see verified | duplicate of round &lt;m&gt; [&lt;severity&gt;] &lt;title&gt;\n  armed:       &lt;the check&gt; failed with the fix broken by &lt;mutation&gt;; passed after a restore\n               from a byte copy, checked with &lt;cmp | grep for identifier&gt;\n  effect:      &lt;numbers that moved, from -&gt; to, by &lt;command&gt;&gt; | none — &lt;command&gt; output identical\n\nTests:       &lt;command&gt; at &lt;sha of the last fix commit&gt; — &lt;result&gt;\nReproduce:   &lt;command&gt; at &lt;sha of the last fix commit&gt; — &lt;result&gt;\nCorrections: &lt;anything an earlier record got wrong, stated here&gt;\nNext:        round &lt;n+1&gt; on the pushed head\n             | stop, defer and merge &lt;sha this round reviewed&gt;\n             | stop, fix and confirm: one confirmation round on the pushed head\n             | split proposed: &lt;link&gt;\n</code></pre>\n<p>Every finding in the final block appears, including the ones that were rejected. A record that lists\nonly the findings acted on hides the reviewer&#39;s error rate, which is the number the next reader needs\nin order to know how far to trust the reviewer.</p>\n<h3 id=\"dispositions\">Dispositions</h3>\n<ul>\n<li><strong>fixed</strong> — verified, fixed, armed, effect measured.</li>\n<li><strong>fixed (cheap)</strong> — a lowest-severity finding fixed because fixing it cost less than recording it.\nIt still gets its effect line. In the round that stops the loop, a cheap fix makes a new head, and\nthat head merges only after one confirmation round has reviewed it; findings that confirmation\nround reports at the lowest severity are deferred, not fixed.</li>\n<li><strong>deferred</strong> — verified and real, not fixed in this pull request. The reason is stated and the\nplace it is tracked is named. <strong>Only a lowest-severity finding can be deferred.</strong> A finding above\nit is fixed or rejected with evidence. An owner who disputes its grade re-scores it explicitly,\nwith the reason in the record — and until it is fixed, or re-scored and graded no higher by a\nlater round&#39;s final review, it blocks the stop rule and the merge.</li>\n<li><strong>rejected</strong> — the claim does not hold. The evidence is recorded: the line that shows it, and the\ninput that behaves correctly. A rejection without evidence is a disagreement, not a disposition.</li>\n<li><strong>duplicate</strong> — the same defect as an earlier finding, perhaps worded differently or graded\ndifferently. Name the earlier one and its state.</li>\n</ul>\n<h3 id=\"the-dispositions-file\">The dispositions file</h3>\n<p>Line 3 of the merge checklist (step 14) does not take the record&#39;s word for it; it reads the\ndispositions of the round that merges from a file beside that round&#39;s final review,\n<code>round-&lt;n&gt;.dispositions</code> in the log directory, written after the findings were read and verified.\nOne line per graded finding of the final review: the finding&#39;s first line exactly as the reviewer\nwrote it, less a leading <code>- </code>, then <code>=&gt;</code>, then its disposition.</p>\n<pre><code class=\"language-text\">[P3] Log line misspells an arm label — src/report.py:41-41 =&gt; deferred: cosmetic, tracked in #212\n[P3] Retry delay is not jittered — src/fetch.py:88-90 =&gt; rejected: jitter is applied in the caller, src/client.py:17\n</code></pre>\n<p>A finding with no line blocks the merge; so does a line with any disposition but <code>deferred</code> or\n<code>rejected</code>, because a finding fixed in the stop round makes a new head, which merges only after its\nown confirmation round. Each line is read whole: it starts with the finding, a deferral names\nboth its reason and <code>tracked in &lt;where&gt;</code>, and a rejection carries its evidence. A bare\n<code>deferred: cosmetic</code> or an empty <code>rejected:</code> blocks the merge as a missing line does. The review\nstep reserves each round number atomically, refuses one that is taken, and pins the round only once\nits review succeeded, so neither dispositions nor a final review from an earlier run stand in for\nthis one.</p>\n<p>A final review that grades no finding at all is not clean on its face. A clean Codex review is\nplain prose — its overall verdict, with no grade and no fixed wording (seen in a Codex session&#39;s own\nrecord of a clean review) — and so is a reviewer&#39;s error message, or a half-written reply. Only the\nperson who read it can tell them apart, so such a round counts as failed unless the file says\nso in a line of its own, <code>clean: &lt;the reviewer&#39;s verdict, quoted&gt;</code>.</p>\n<h3 id=\"measuring-an-effect\">Measuring an effect</h3>\n<p>&quot;Effect&quot; means what the fix changed outside the code: a published number, an output a user sees, a\nrow written to a store. Where the pull request publishes numbers, measure it.</p>\n<ol>\n<li>Run the reproduce script, or the command that produces the published output, on the commit\nbefore the fix. Keep its outputs.</li>\n<li>Run it on the commit with the fix.</li>\n<li>Diff the two. Every changed number goes in the effect line, from what to what.</li>\n</ol>\n<p>&quot;None&quot; is a result of that diff, not a judgement about the fix. Write it with the command that\nproduced the identical outputs. Where nothing is published, the effect is the behaviour that changed:\nname the test that now passes and what it asserts.</p>\n<p>A finding whose fix moves a published number is also a correction to what was published. Record it\nwhere the published numbers live as well — in the study&#39;s addendum or the report&#39;s corrections —\nand not only in the review record.</p>\n","words":1855}],"body":"# Run an independent review loop\n\nA second reviewer earns its place by reading what the author cannot: not the diff they meant to\nwrite, but the system the diff lands in. The loop around it is where that value leaks away. The log\nholds several blocks and the wrong one gets read. A finding gets fixed because it sounded right,\nand it was not. A fix gets a test that was never seen failing. The test's mutation gets undone with\na command that also undid the fix. \"No effect on the results\" gets written without anything being\nmeasured. Rounds go on for ever because every one finds something new. And the head that finally\nmerges is one nobody reviewed, because a last small fix went in after the final round.\n\nThis skill is the loop: what a round consists of, what each finding is owed, when the loop stops,\nwhen it should stop and split instead, and what has to be true of the exact commit that merges. It\nis reviewer-agnostic. The examples use the Codex CLI, `codex review --base origin/main`, because\nthat is a common reviewer that takes a base and grades its findings; any reviewer that does both\nfits. Its `exec` form, `codex exec review --base <base sha> -o <file>`, also writes the final\nreview to a file of its own; the examples read it there, and pass the base as the sha recorded.\n\n### What this skill does not own\n\n| The job | Whose it is | What this skill does with it |\n|---|---|---|\n| The review loop with Blocks as the reviewer | `request-blocks-review` | Runs beside it when both are wanted; the two catch different things. |\n| Blocks sessions and status waits | `blocks` | Uses none of it. |\n| Containing a change whose side effects are the risk | `land-complex-change` | Reviews the change once it is contained; owns no budget. |\n| Checking a claim about how the code works | `investigate-codebase` | Calls it when a finding's claim is not settled by reading one place. |\n| Describing what the pull request does | `describe-changes` | Hands it the final diff. |\n| Telling the reader where the rounds stand | `report-progress` | Supplies the round number, the findings by severity and the head. |\n| Recording why a finding was rejected or deferred | `decision-journal` | Hands over the disposition and its evidence when it is contested. |\n\nInstall the companions with `npx skills add crissmoldovan/agent-skills`.\n\n## When to Use\n\n- A pull request is functionally done and needs an independent review before it merges.\n- A second reviewer is wanted beside a hosted one. One tends to read the diff and the other the\n  system, and they report different defects.\n- The pull request changes numbers somebody has already read — a study, a report, a metric — so a\n  finding can move a published result.\n- An earlier round found something, the fix is in, and the new head has to be reviewed.\n\nDo not use it before a diff exists: a review of an intention reviews nothing. Do not use it for the\nBlocks-hosted loop — `request-blocks-review` owns that and its waits. Do not count the author\nagent's own reading of its diff as this review: the point is a reviewer that did not write the\ncode. And do not use it to decide scope: when the rounds say the pull request is too big, this\nskill says so and proposes a split, and the person who owns the work decides.\n\n## Prerequisites\n\n1. **A pushed branch with a known base.** The base is the branch the pull request merges into,\n   fetched in this session.\n   **Complete when:** `git fetch origin` ran, and the head sha under review is written down.\n2. **A reviewer that reviews a diff against a base and grades severity, and its declared scale.**\n   Take the scale from the reviewer itself — its documentation or its own output — never from\n   memory, and derive the threshold from it: every grade above the lowest is fixed, and a round\n   with only the lowest grade stops the loop. The Codex CLI grades P0 to P3, so with it P0, P1 and\n   P2 are fixed and a round with only P3 findings stops the loop. A finding graded outside the\n   declared scale stops the round until the scale is established again.\n   **Complete when:** the reviewer command, its declared scale and its lowest grade are named,\n   with where the scale was read.\n3. **The checks a fix must pass.** The tests, and the reproduce script if the pull request\n   publishes numbers.\n   **Complete when:** each is named with the command that runs it, and each has run once here.\n4. **A place for review records and a place for raw logs.** Records go on the pull request, as a\n   comment or a section of its description, or in files committed after the fixes they describe.\n   Raw logs live outside the repository, because a reviewer reading the repository can find old\n   logs and quote them into the new one.\n   **Complete when:** both locations are named.\n5. **The merge rules.** Who merges, the required checks, and the merge method.\n   **Complete when:** the required checks are listed from the repository, not from memory.\n\n## Procedure\n\n1. **Pin the head under review, and review exactly its bytes.** Record the sha for the round, after\n   the push, and the base sha the reviewer will diff against — the merge rests on both. A reviewer\n   reads the working tree it runs in, so the tree must be that commit and nothing else: every round\n   runs in a fresh worktree checked out at the recorded sha (`git worktree add --detach <path> <sha>`),\n   never in the checkout. `git status --porcelain` does not list ignored files, and the reviewer\n   reads them — generated configuration, build output — as if they were the commit. An uncommitted\n   edit, an untracked or ignored file or an unpushed commit in the reviewed tree is reviewed and\n   never merged — or merged and never reviewed. Check the tree again when the reviewer exits: one\n   that wrote there or moved `HEAD` reviewed something else. The worktree goes when the round ends.\n   **Complete when:** the round's record names the head and base shas, the remote branch points at\n   the head, the reviewer ran in a fresh worktree whose `HEAD` was that sha and whose\n   `git status --porcelain --ignored` was empty before the review and after it, and the worktree\n   and its directory are gone.\n\n2. **Start the reviewer in the background, writing to a file.** A review can take many minutes, and\n   output read live from a terminal arrives interleaved and half-finished. For example:\n   `codex exec review -c project_doc_max_bytes=0 --base \"$base\" -o \"$REVIEW_LOGS/round-<n>.final.txt\" > \"$REVIEW_LOGS/round-<n>.log\" 2>&1 &`,\n   with the final-review file removed first and each round number reserved once, atomically, so\n   nothing from an earlier or a concurrent round stands in for this one. `$base` is the sha step 1\n   recorded, never a name the reviewer would resolve for itself, later. The `-c` flag stops Codex\n   reading instructions from the tree; a tree holding `.codex/` or `.agents/`, which no flag stops, is\n   refused ([why](references/merge-preconditions.md)). The log directory is an absolute path outside\n   the reviewed tree and every worktree of the checkout: a relative one lands the final review in the\n   tree under review, and a log in a worktree gets committed and quoted by a later round. Wait for\n   the process to exit before reading anything, and keep its exit status: a reviewer that exited\n   non-zero did not finish a review.\n   **Complete when:** the reviewer exited zero, and its full output is in the round's log file — or\n   the round is recorded as failed and run again as a new round.\n\n3. **Read only the final review.** A reviewer's log holds drafts, tool output and earlier messages\n   before its final review, and it can quote old review files it found in the repository, so the\n   review has to be taken from a boundary nothing in the log can fake. The Codex CLI's exec form\n   writes the final message, and only that, to the file `-o` names: read that file. A reviewer\n   that only prints a log needs its final block cut out by a marker line, which is a fallback with a\n   known flaw — a quoted line that equals the marker restarts the cut and silently drops the\n   findings before it — so count the markers and compare the cut with the log by eye\n   ([the review record](references/review-record.md) has both). A final review that is missing or\n   empty is a **failed round**, not a clean one: nothing reads exactly like \"no findings\". Nor is a\n   review that grades no finding clean on its face: a clean Codex review is plain prose, with no\n   grade and no fixed wording, so a person reads it and records it clean, or the round failed.\n   **Complete when:** the reviewer exited zero, its final review is non-empty, the round's findings\n   come from it alone, and the record says how it was taken — the `-o` file, or a marker cut with\n   its marker count — or the round is recorded as failed and run again.\n\n4. **Check every finding against the code or the data before acting on it.** A reviewer's claim\n   about the codebase can be wrong: a line that does not do what it says, a caller that does not\n   exist, a case already handled two functions away. Read the cited code, then reproduce the\n   problem with an input that shows it. A claim that does not hold is rejected with the evidence.\n   It is not fixed to make the reviewer happy.\n   **Complete when:** every finding is marked verified, with the reproducing input, or rejected,\n   with the evidence that refutes it.\n\n5. **Fix every verified finding above the lowest severity.** At the lowest severity, fix the cheap\n   ones and record the rest with a reason — in a round the next round will review. In the round\n   that stops the loop, step 12 decides instead. A severity is a judgement, not a measurement: the\n   same defect can be graded differently on two heads, so judge a lowest-severity finding on its\n   content before deferring it.\n   Nothing above the lowest severity is deferred. An owner who disputes a grade re-scores the\n   finding explicitly, with the reason in the record — and until the finding is fixed or re-scored\n   that way, and a round's final review no longer grades it above the lowest, it blocks the stop\n   rule and the merge.\n   **Complete when:** every verified finding above the lowest severity is fixed, and every\n   lowest-severity finding is fixed or recorded as deferred with a reason.\n\n6. **Arm every fix: watch its check fail with the fix broken.** Write a test or a self-check for\n   the fix. Copy the fixed file byte for byte to a scratch path, break the fix on purpose, run the\n   check and watch it fail for the right reason, then restore from the byte copy and confirm the\n   restore by content before running the check again. Never restore with `git checkout --` or\n   `git restore`: the fix is usually uncommitted in that same file, and the restore throws it away\n   along with the mutation, silently ([arming a fix](references/arming-a-fix.md)).\n   **Complete when:** every fix has a recorded failing run under a named mutation and a passing\n   run after a restore checked with `cmp` or a search for the fix's own identifier.\n\n7. **Diff shared code against the base after every fix.** A fix aimed at one path often runs\n   through a function every path shares, and can quietly change what the default path does — a\n   guard added for an edge case that also rewrites the ordinary case.\n   **Complete when:** every shared function the round touched has been diffed against the base,\n   and each change to its default behaviour is intended and tested.\n\n8. **Measure each finding's effect on any published result.** Where the pull request publishes\n   numbers, rerun them with the fix and compare them with the published ones. Write \"no effect\"\n   only when that comparison shows no change, and name the command that showed it.\n   **Complete when:** every finding has an effect line — the numbers that moved, from what to what,\n   or \"none\", backed by a named command and its output.\n\n9. **Run the tests and the reproduce script on the fixed tree.**\n   **Complete when:** both have run on the last fix commit, and their results are in the record.\n\n10. **Write the round's review record.** The head reviewed, the reviewer command, and for each\n    finding its severity and title as the reviewer gave them, whether it was verified, its\n    disposition, its armed evidence, its effect, and the commit that fixed it. A correction to an\n    earlier round's record is written as a correction in this one. The earlier record is never\n    edited to look as though it had always been right. Put the record where it does not move the\n    head under review: on the pull request, as a comment or a section of its description. A\n    repository that keeps records as files commits each one after the fixes it describes, never\n    with them — a file cannot name the commit that adds it — so the next round reviews it along\n    with them. The last round's record always goes on the pull request: a commit after the last\n    review is a head nobody reviewed.\n    **Complete when:** every finding in the last block appears in the record, and the record is on\n    the pull request or in a commit after the fixes it names.\n\n11. **Push, and review the new head.** The fixes are new code and get their own round.\n    **Complete when:** the next round is pinned to the pushed head, or the stop rule below applies.\n\n12. **Stop when a round returns only lowest-severity findings, and leave a reviewed head to merge.**\n    That round reviewed its head and nothing after it, so any commit made now is unreviewed. Take\n    one of two exits:\n    - **Defer and merge.** Record every finding as deferred, with where it is tracked, and merge the\n      head that round reviewed. The records go in the round's dispositions file, one complete line\n      per finding, which the merge checklist reads.\n    - **Fix, then confirm once.** Fix the findings worth fixing, armed as in step 6, push, and run\n      one confirmation round on the new head. If it returns nothing above the lowest severity, that\n      head is the one that merges, and anything it reports at the lowest severity is deferred, not\n      fixed — a fix would need another round, and the loop would not end. If it returns anything\n      above the lowest severity, the loop resumes at step 4 on that head.\n\n    **Complete when:** the head that will merge is the head of a round that returned only\n    lowest-severity findings — the stop round's, or its one confirmation round's — with no commit\n    after it, and every finding from that round is recorded as deferred with its tracking, or\n    rejected with its evidence.\n\n13. **Split the pull request when rounds keep finding new kinds of bug.** Rephrasings of one defect\n    converge. A run of rounds that each find a class of defect no earlier round found — the same\n    subsystem failing in a new way each time — does not converge, and the next round will find\n    another. After about three such rounds, stop iterating: propose a split that moves the\n    subsystem that keeps failing into its own pull request, and let the owner decide.\n    **Complete when:** the split is proposed with the classes found so far, or the rounds are\n    converging and the record shows it.\n\n14. **Merge only the head that was reviewed and checked, by hand, after a checklist.** Merging is a\n    person's act, and this skill ships no merge script: three rounds running found a new way for a\n    scripted gate to merge what nobody reviewed. Check each line, and stop at the first that fails\n    ([merge preconditions](references/merge-preconditions.md) says why each one is there):\n    1. The pull request's head is the sha the final round reviewed (`round-<n>.head`) — under\n       step 12, the stop round's or its one confirmation round's — with no commit after it.\n    2. No earlier round that did not end the loop reviewed that same head, unless every finding it\n       graded above the lowest was rejected with evidence. A defect a round found is fixed in a new\n       head, never reviewed away by running the review again until a run comes back clean.\n    3. Every finding of the final round has a complete disposition in `round-<n>.dispositions`; a\n       review that graded none was recorded `clean:` by the person who read it, or the round failed.\n    4. The base branch's live tip (`git ls-remote origin refs/heads/<base>`) is the base the round\n       recorded (`round-<n>.base`). If it moved, review again; `baseRefOid` does not see it move.\n    5. It targets the branch it should, not a base that merged and is gone, and it is mergeable.\n    6. Every required check completed and passed on that exact commit: a zero exit, a non-empty\n       list, every one passed. No checks is not a pass, and a conflicting pull request gets none.\n    7. The pull request did not configure its own review: the round ran the reviewer with the tree's\n       instructions off, or a person read every change the diff makes to instruction files, symbolic\n       links and reviewer configuration, and recorded that in the round's record.\n\n    Then merge with the head pinned, so that a push in between fails the merge instead of merging\n    unreviewed code: `gh pr merge <n> --merge --match-head-commit <reviewed sha>`.\n    **Complete when:** every line held and the merge ran with `--match-head-commit` set to the\n    reviewed head — or a line failed, and the record says which.\n\n## Usage Examples\n\n```text\nRun codex review on this PR against origin/main in the background, writing to a file. Read only the\nfinal review. Fix every P0, P1 and P2 with a check you have watched fail, write the round's\nreview record, and go again until a round comes back with only P3s.\n```\n\n```text\nThe reviewer says the parser drops empty rows. Before you change anything, show me that it is true:\nthe line it means, and an input that proves it.\n```\n\n```text\nThis PR changes numbers in a published report. For every finding, tell me whether fixing it moves a\npublished number, and by how much. Do not write \"no effect\" unless you measured it.\n```\n\n```text\nThat is the fourth round in a row that found a new kind of bug. Stop iterating, and propose how to\nsplit this PR so that the part that keeps failing gets its own branch.\n```\n\n```bash\n# Fail fast: a command that fails stops the recipe, so nothing after it runs on a false premise —\n# no review of a tree that was never fetched, no round counted after a failed review.\nset -euo pipefail\n\n# One round of review. It never merges: the merge is a person's act, after step 14's checklist.\n# REVIEW_LOGS is absolute, outside the review tree and every worktree of this checkout.\n: \"${ROUND:?set ROUND to the number of this round}\"\n: \"${REVIEW_LOGS:?set REVIEW_LOGS to an absolute directory outside the repository}\"\ncase \"$REVIEW_LOGS\" in /*) ;; *) echo \"REFUSE: REVIEW_LOGS must be an absolute path\"; exit 1;; esac\n\n# A round counts only if the reviewer exited zero AND wrote a non-empty final review, which the exec\n# form writes, and only that, to the file -o names: no log marker can cut it. A failed round leaves none.\nreview_round() {  # review_round <n> <tree> <base sha>\n  local tree_abs listed wt wt_abs logs_abs log final\n  case \"$REVIEW_LOGS\" in /*) ;; *) echo \"ROUND $1 REFUSED: REVIEW_LOGS must be an absolute path\"; return 1;; esac\n  # The reviewer gets the recorded sha, never a name it would resolve for itself when it starts.\n  [[ \"${3:-}\" =~ ^[0-9a-f]{40}([0-9a-f]{24})?$ ]] || { echo \"ROUND $1 REFUSED: the base must be the recorded sha, not a name\"; return 1; }\n  tree_abs=$(cd \"$2\" && pwd -P) && mkdir -p \"$REVIEW_LOGS\" && logs_abs=$(cd \"$REVIEW_LOGS\" && pwd -P) || return 1\n  # The reviewed tree, then every worktree of this checkout, the checkout included. NUL-delimited (-z,\n  # git 2.36+): a path may hold a newline. A list git did not finish has no END record, and refuses.\n  while IFS= read -r -d '' wt; do\n    case $wt in END) listed=yes; continue;; \"worktree \"*) wt=${wt#worktree };; *) continue;; esac\n    wt_abs=$(cd \"$wt\" 2>/dev/null && pwd -P) || wt_abs=$wt\n    case \"$logs_abs/\" in \"$wt_abs\"/*|\"$wt\"/*) echo \"ROUND $1 REFUSED: REVIEW_LOGS is inside the reviewed tree or a worktree of this checkout: $wt\"; return 1;; esac\n  done < <(printf 'worktree %s\\0' \"$tree_abs\"; git worktree list --porcelain -z && printf 'END\\0')\n  [ \"${listed:-}\" = yes ] || { echo \"ROUND $1 REFUSED: git could not list this checkout's worktrees\"; return 1; }\n  # The reviewer takes nothing from the tree: -c turns off its instruction files; these two no flag does.\n  for wt in .codex .agents; do if [ -e \"$2/$wt\" ] || [ -L \"$2/$wt\" ]; then echo \"ROUND $1 REFUSED: the reviewed tree holds $wt, which configures its reviewer\"; return 1; fi; done\n  log=\"$logs_abs/round-$1.log\"; final=\"$logs_abs/round-$1.final.txt\"\n  rm -f \"$final\" \"$logs_abs/round-$1.dispositions\"  # nothing from an earlier run stands in for this one\n  (cd \"$2\" && codex exec review -c project_doc_max_bytes=0 --base \"$3\" -o \"$final\") > \"$log\" 2>&1 &\n  wait $! || { rm -f \"$final\"; echo \"ROUND $1 FAILED: the reviewer exited non-zero; not a clean round\"; return 1; }\n  grep -q '[^[:space:]]' \"$final\" 2>/dev/null \\\n    || { rm -f \"$final\"; echo \"ROUND $1 FAILED: no final review was written; not a clean round\"; return 1; }\n}\n\n# A round is terminal only if every grade in its final review is the lowest of the declared scale, for\n# the Codex CLI P3. Any other grade, above it or outside the scale (a P4), is not: never merge on it.\nterminal_round() {  # terminal_round <n>\n  local final=\"$REVIEW_LOGS/round-$1.final.txt\" other\n  [ -s \"$final\" ] || { echo \"NOT TERMINAL: round $1 has no final review\"; return 1; }\n  other=$(grep -Eo '\\[P[0-9]+\\]' \"$final\" | sort -u | grep -vx '\\[P3\\]' || true)\n  [ -z \"$other\" ] || { echo \"NOT TERMINAL: round $1 grades findings other than the lowest, P3:\" $other; return 1; }\n}\n\n# HEAD is the sha and git lists nothing, ignored files included. A git that failed proves nothing: fail.\nexact_tree() {  # exact_tree <tree> <sha>\n  local head status; head=$(git -C \"$1\" rev-parse HEAD) && status=$(git -C \"$1\" status --porcelain --ignored) || return 1\n  [ \"$head\" = \"$2\" ] && [ -z \"$status\" ]\n}\n\n# A round number is reserved atomically, by mkdir, and never reused. Review exactly the pushed bytes in a\n# fresh detached worktree, never the checkout, whose ignored files `git status --porcelain` hides.\nmkdir -p \"$REVIEW_LOGS\" && mkdir \"$REVIEW_LOGS/round-$ROUND.lock\" 2>/dev/null || { echo \"REFUSE: round $ROUND is taken: it ran, or is running; review as a new round\"; exit 1; }\ngit fetch origin\nsha=$(git rev-parse '@{upstream}'); base=$(git rev-parse origin/main)\nscratch=$(mktemp -d \"${TMPDIR:-/tmp}/review-tree.XXXXXX\"); tree=\"$scratch/tree\"\ntrap 'git worktree remove --force \"$tree\" 2>/dev/null || rm -rf \"$tree\"; rm -rf \"$scratch\"; git worktree prune' EXIT\ngit worktree add --detach \"$tree\" \"$sha\"\nexact_tree \"$tree\" \"$sha\" || { echo \"REFUSE: the review tree is not exactly $sha\"; exit 1; }\nreview_round \"$ROUND\" \"$tree\" \"$base\"    # a failed round stops here, before anything is pinned\n# Check again: a reviewer that wrote into the tree, built there or moved HEAD reviewed something else.\nexact_tree \"$tree\" \"$sha\" || { rm -f \"$REVIEW_LOGS/round-$ROUND.final.txt\"; echo \"ROUND $ROUND FAILED: the review tree changed while it was reviewed, or git could not tell; nothing is pinned\"; exit 1; }\necho \"$sha\" > \"$REVIEW_LOGS/round-$ROUND.head\"; echo \"$base\" > \"$REVIEW_LOGS/round-$ROUND.base\"\nterminal_round \"$ROUND\"          # so does a round with P0-P2 findings left\necho \"Round $ROUND is terminal. Record a complete disposition per finding in round-$ROUND.dispositions; a review\"\necho \"that grades none failed, unless you read it and record it clean:. Then work through step 14's checklist.\"\n```\n\n## What it looks like\n\nA specimen, not a prompt.\n\n### A round's review record\n\n```text\nReview round 3 — PR <number> — head <sha> against origin/main at <base sha> — posted on the PR\nReviewer: codex exec review -c project_doc_max_bytes=0 --base <base sha> -o <file>; final review from -o\n\n[P1] The scorer counts a \"does not apply\" answer as an invention\n  verified: yes — <file>:<line>; fixture item <id> reproduces it\n  disposition: fixed in <sha>\n  armed: test \"not-applicable is not invention\" failed with the fix broken; passed after a\n         restore from a byte copy, checked with cmp\n  effect: arm B invention <x>% -> <y>% (reproduce.sh, tables/bar-2.csv); bar 2 verdict unchanged\n\n[P1] \"The loader skips the header row twice\"\n  verified: no — the header is read once (<file>:<line>); a fixture with a header and one row\n            loads one row\n  disposition: rejected, evidence above\n  effect: none — nothing was changed; reproduce.sh output byte-identical at this head\n\n[P3] A log line misspells an arm label\n  verified: yes — <file>:<line> prints \"arm-B\" where the label is \"arm B\"\n  disposition: fixed (cheap) in <sha>\n  armed: test \"log lines use the arm's label\" failed with the fix broken; passed after a restore\n         from a byte copy, checked with cmp\n  effect: none — reproduce.sh output byte-identical before and after\n\nTests: <command> — all passing at <sha>. reproduce.sh: identical except tables/bar-2.csv, as above.\nCorrection to round 2: its P1 on the cache key was marked fixed in <sha>; that commit fixed the\nread path only. The write path is fixed in this round, in <sha>.\nNext: round 4 on <sha>, the last fix commit, once pushed.\n```\n\nEvery finding has a verified line and an effect line, and every fix an armed line: the record meets\nthe contract it describes. Each finding says whether it was true, what was done, how the fix was\nproven to matter, and what it changed in the published numbers. The rejected finding carries its evidence. The correction to the\nearlier round is stated where the reader will see it.\n\n## Pitfalls\n\n- **Reading the whole log.** Drafts, tool output and quoted old reviews precede the final block. In\n  one loop the reviewer printed review files it found in the repository, and an extraction that\n  began at the first block presented three earlier rounds' findings as the current one's.\n- **Fixing a claim nobody checked.** A reviewer is often right and sometimes confidently wrong\n  about what the code does. An unverified \"fix\" for a defect that does not exist is a real change\n  with no reason behind it.\n- **A fix whose check never failed.** A test written after the fix and green from its first run\n  proves that it runs, not that it guards anything.\n- **Restoring a mutation with version control.** `git checkout --` restores the last committed\n  version, which predates the uncommitted fix. The fix disappears, the suite still passes because\n  its own test went with it, and nothing reports either.\n- **\"No effect\" with no measurement.** It reads as a finding and is a guess. Published numbers are\n  exactly where an unmeasured guess does the most damage.\n- **A fix that changes the default path.** A shape guard added for an override path can change\n  what the ordinary path does with an edge input, and no finding pointed there.\n- **Rounds that do not converge.** Each finds a new class of defect, each fix adds surface, and the\n  next round finds the next class. The way out is a smaller pull request, not another round.\n- **Severity as a verdict.** The same defect has been graded high on one head and lower on the\n  next, and the check went green with the defect still in place. Judge the content, and fix a head\n  graded above the lowest; do not review it again until a run grades it lower.\n- **A marker the review itself can contain.** Cutting the final block out of a log at the last line\n  reading `codex` breaks the moment the review quotes a file or a command output with such a line:\n  the cut restarts there and the findings before it vanish, while the tail left over still looks\n  like a review. Take the final message from a file the reviewer writes, where it has one.\n- **A failed round read as a clean one.** A reviewer that crashed, was rate-limited or was logged\n  out leaves a log with no final block, and an extraction over it returns nothing — which looks\n  exactly like a review with no findings. A round counts only on a zero exit and a non-empty final\n  block.\n- **A dirty tree under review.** The reviewer reads the files in front of it. An edit made after\n  the push, or a file never committed, is reviewed and then never merged, and a commit not yet\n  pushed is merged without the review having seen it on the branch. A checkout that holds only\n  ignored files looks clean to `git status --porcelain` and is not. Review a fresh worktree at the\n  pushed sha, and remove it when the round ends: rounds that leave theirs pile up. A tree clean\n  before the review says nothing about the tree the reviewer left: check it again after it exits.\n- **A base that moved after the review.** The head pin does not cover it, and `baseRefOid` does\n  not see it: on one open pull request it named a base 17 commits behind the base branch's tip,\n  and the pull request read `MERGEABLE`. Compare the branch's live tip with the round's base.\n- **The lowest grade taken from memory.** One reviewer's scale ends at P2 and another's at P3. A\n  threshold copied from the wrong one stops the loop a grade early and leaves a whole grade of\n  findings unfixed. Read the scale from the reviewer.\n- **A scripted merge gate.** Three rounds running found a new way for one to merge what nobody\n  reviewed: findings not yet read, a base that moved, a reused round, a head reviewed again until a\n  run came back clean. Merge by hand after the checklist, pinned with `--match-head-commit`. And\n  `gh pr checks --json` exits zero even when a check has failed: read the buckets.\n- **Merging a head nobody reviewed.** A last \"trivial\" fix pushed after the final round merges\n  unreviewed and unchecked unless the merge is pinned to the reviewed head. The commonest version\n  is the stop round's own lowest-severity findings, fixed \"because they were cheap\" and merged\n  without the one confirmation round that would have reviewed them.\n- **A record committed with the fixes it names.** A file cannot carry the sha of the commit that\n  adds it, and a record committed after the last round is itself an unreviewed head. Records go\n  on the pull request, or in a commit after the fixes that the next round then reviews.\n- **Editing an earlier round's record.** A record quietly corrected in place makes every other\n  record untrustworthy. Corrections go forward, stated as corrections.\n\n## Verification\n\n- [ ] Each round names the head sha it reviewed and the base sha it diffed against, and the remote\n      branch pointed at the head.\n- [ ] Each round reviewed a fresh worktree at that sha whose `git status --porcelain --ignored`\n      was empty — never the checkout — and the worktree and its directory were removed after. The\n      tree was checked again after the reviewer exited: `HEAD` still that sha, and nothing listed.\n- [ ] The reviewer ran in the background, given the recorded base sha rather than a branch name, to\n      a log directory outside every worktree of the checkout, and was read only after it exited.\n- [ ] Each round counted only on a zero exit and a non-empty final review; any other round was\n      recorded as failed and run again.\n- [ ] Each round's findings came from the reviewer's final message alone — the file its `-o`\n      option wrote, or, for a reviewer with only a log, a marker cut checked against the log.\n- [ ] The threshold came from the reviewer's declared scale — for the Codex CLI, P0 to P3: P0 to\n      P2 fixed, a P3-only round stops the loop.\n- [ ] Every finding was verified against the code or data, or rejected with evidence.\n- [ ] Every verified finding above the lowest severity was fixed; lowest-severity findings were\n      fixed if cheap and otherwise recorded with a reason.\n- [ ] Every fix has a check that was watched failing with the fix broken, and passing after a\n      restore from a byte copy that was checked by content.\n- [ ] No `git checkout --` or `git restore` was used to undo a mutation.\n- [ ] Shared code touched by a fix was diffed against the base, and default-path changes are\n      intended and tested.\n- [ ] Every finding has an effect line, and every \"none\" names the command that measured it.\n- [ ] Tests and the reproduce script ran on the last fix commit of each round.\n- [ ] A review record exists for every round, and corrections to earlier rounds are stated in\n      later records rather than edited into earlier ones.\n- [ ] The loop stopped on a round with only lowest-severity findings — or a split was proposed\n      after rounds kept finding new kinds of bug.\n- [ ] At the stop, its findings were either all deferred and the reviewed head merged, or fixed\n      and then reviewed by exactly one confirmation round, whose own lowest-severity findings were\n      deferred.\n- [ ] The merged head is the head of the stop round or of its one confirmation round, with no\n      commit after it; its base is the intended branch; and every required check completed and\n      passed on that exact commit.\n- [ ] Every record is on the pull request, or in a commit after the fixes it names — none names\n      its own commit, and none follows the last review.\n- [ ] The merge ran by hand after every line of step 14's checklist held: the reviewed head, not\n      reviewed before by a round that did not end the loop; a complete disposition per finding, or\n      the review recorded clean; the recorded base still the branch's tip; the intended branch,\n      mergeable; a non-empty, all-passed list of required checks from a zero-exit call; and the\n      reviewer run with the tree's instructions off, or every change to instruction files, symbolic\n      links and reviewer configuration read by a person and recorded.\n- [ ] The merge used `--match-head-commit`.\n\n## Deeper reading\n\n- [The review record](references/review-record.md): extracting the final block, the record's\n  fields, the dispositions and the file the merge checklist reads them from, and measuring an effect.\n- [Arming a fix](references/arming-a-fix.md): the byte-copy mutation, why version control is the\n  wrong restore, and how to confirm a restore by content.\n- [Merge preconditions](references/merge-preconditions.md): why each line of the merge checklist is\n  there, the measured `gh` behaviours behind them, and the pinned merge.\n","bodyHtml":"<h2 id=\"run-an-independent-review-loop\">Run an independent review loop</h2>\n<p>A second reviewer earns its place by reading what the author cannot: not the diff they meant to\nwrite, but the system the diff lands in. The loop around it is where that value leaks away. The log\nholds several blocks and the wrong one gets read. A finding gets fixed because it sounded right,\nand it was not. A fix gets a test that was never seen failing. The test&#39;s mutation gets undone with\na command that also undid the fix. &quot;No effect on the results&quot; gets written without anything being\nmeasured. Rounds go on for ever because every one finds something new. And the head that finally\nmerges is one nobody reviewed, because a last small fix went in after the final round.</p>\n<p>This skill is the loop: what a round consists of, what each finding is owed, when the loop stops,\nwhen it should stop and split instead, and what has to be true of the exact commit that merges. It\nis reviewer-agnostic. The examples use the Codex CLI, <code>codex review --base origin/main</code>, because\nthat is a common reviewer that takes a base and grades its findings; any reviewer that does both\nfits. Its <code>exec</code> form, <code>codex exec review --base &lt;base sha&gt; -o &lt;file&gt;</code>, also writes the final\nreview to a file of its own; the examples read it there, and pass the base as the sha recorded.</p>\n<h4 id=\"what-this-skill-does-not-own\">What this skill does not own</h4>\n<table>\n<thead>\n<tr>\n<th>The job</th>\n<th>Whose it is</th>\n<th>What this skill does with it</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>The review loop with Blocks as the reviewer</td>\n<td><code>request-blocks-review</code></td>\n<td>Runs beside it when both are wanted; the two catch different things.</td>\n</tr>\n<tr>\n<td>Blocks sessions and status waits</td>\n<td><code>blocks</code></td>\n<td>Uses none of it.</td>\n</tr>\n<tr>\n<td>Containing a change whose side effects are the risk</td>\n<td><code>land-complex-change</code></td>\n<td>Reviews the change once it is contained; owns no budget.</td>\n</tr>\n<tr>\n<td>Checking a claim about how the code works</td>\n<td><code>investigate-codebase</code></td>\n<td>Calls it when a finding&#39;s claim is not settled by reading one place.</td>\n</tr>\n<tr>\n<td>Describing what the pull request does</td>\n<td><code>describe-changes</code></td>\n<td>Hands it the final diff.</td>\n</tr>\n<tr>\n<td>Telling the reader where the rounds stand</td>\n<td><code>report-progress</code></td>\n<td>Supplies the round number, the findings by severity and the head.</td>\n</tr>\n<tr>\n<td>Recording why a finding was rejected or deferred</td>\n<td><code>decision-journal</code></td>\n<td>Hands over the disposition and its evidence when it is contested.</td>\n</tr>\n</tbody></table>\n<p>Install the companions with <code>npx skills add crissmoldovan/agent-skills</code>.</p>\n<h3 id=\"when-to-use\">When to Use</h3>\n<ul>\n<li>A pull request is functionally done and needs an independent review before it merges.</li>\n<li>A second reviewer is wanted beside a hosted one. One tends to read the diff and the other the\nsystem, and they report different defects.</li>\n<li>The pull request changes numbers somebody has already read — a study, a report, a metric — so a\nfinding can move a published result.</li>\n<li>An earlier round found something, the fix is in, and the new head has to be reviewed.</li>\n</ul>\n<p>Do not use it before a diff exists: a review of an intention reviews nothing. Do not use it for the\nBlocks-hosted loop — <code>request-blocks-review</code> owns that and its waits. Do not count the author\nagent&#39;s own reading of its diff as this review: the point is a reviewer that did not write the\ncode. And do not use it to decide scope: when the rounds say the pull request is too big, this\nskill says so and proposes a split, and the person who owns the work decides.</p>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<ol>\n<li><strong>A pushed branch with a known base.</strong> The base is the branch the pull request merges into,\nfetched in this session.\n<strong>Complete when:</strong> <code>git fetch origin</code> ran, and the head sha under review is written down.</li>\n<li><strong>A reviewer that reviews a diff against a base and grades severity, and its declared scale.</strong>\nTake the scale from the reviewer itself — its documentation or its own output — never from\nmemory, and derive the threshold from it: every grade above the lowest is fixed, and a round\nwith only the lowest grade stops the loop. The Codex CLI grades P0 to P3, so with it P0, P1 and\nP2 are fixed and a round with only P3 findings stops the loop. A finding graded outside the\ndeclared scale stops the round until the scale is established again.\n<strong>Complete when:</strong> the reviewer command, its declared scale and its lowest grade are named,\nwith where the scale was read.</li>\n<li><strong>The checks a fix must pass.</strong> The tests, and the reproduce script if the pull request\npublishes numbers.\n<strong>Complete when:</strong> each is named with the command that runs it, and each has run once here.</li>\n<li><strong>A place for review records and a place for raw logs.</strong> Records go on the pull request, as a\ncomment or a section of its description, or in files committed after the fixes they describe.\nRaw logs live outside the repository, because a reviewer reading the repository can find old\nlogs and quote them into the new one.\n<strong>Complete when:</strong> both locations are named.</li>\n<li><strong>The merge rules.</strong> Who merges, the required checks, and the merge method.\n<strong>Complete when:</strong> the required checks are listed from the repository, not from memory.</li>\n</ol>\n<h3 id=\"procedure\">Procedure</h3>\n<ol>\n<li><p><strong>Pin the head under review, and review exactly its bytes.</strong> Record the sha for the round, after\nthe push, and the base sha the reviewer will diff against — the merge rests on both. A reviewer\nreads the working tree it runs in, so the tree must be that commit and nothing else: every round\nruns in a fresh worktree checked out at the recorded sha (<code>git worktree add --detach &lt;path&gt; &lt;sha&gt;</code>),\nnever in the checkout. <code>git status --porcelain</code> does not list ignored files, and the reviewer\nreads them — generated configuration, build output — as if they were the commit. An uncommitted\nedit, an untracked or ignored file or an unpushed commit in the reviewed tree is reviewed and\nnever merged — or merged and never reviewed. Check the tree again when the reviewer exits: one\nthat wrote there or moved <code>HEAD</code> reviewed something else. The worktree goes when the round ends.\n<strong>Complete when:</strong> the round&#39;s record names the head and base shas, the remote branch points at\nthe head, the reviewer ran in a fresh worktree whose <code>HEAD</code> was that sha and whose\n<code>git status --porcelain --ignored</code> was empty before the review and after it, and the worktree\nand its directory are gone.</p>\n</li>\n<li><p><strong>Start the reviewer in the background, writing to a file.</strong> A review can take many minutes, and\noutput read live from a terminal arrives interleaved and half-finished. For example:\n<code>codex exec review -c project_doc_max_bytes=0 --base &quot;$base&quot; -o &quot;$REVIEW_LOGS/round-&lt;n&gt;.final.txt&quot; &gt; &quot;$REVIEW_LOGS/round-&lt;n&gt;.log&quot; 2&gt;&amp;1 &amp;</code>,\nwith the final-review file removed first and each round number reserved once, atomically, so\nnothing from an earlier or a concurrent round stands in for this one. <code>$base</code> is the sha step 1\nrecorded, never a name the reviewer would resolve for itself, later. The <code>-c</code> flag stops Codex\nreading instructions from the tree; a tree holding <code>.codex/</code> or <code>.agents/</code>, which no flag stops, is\nrefused (<a href=\"references/merge-preconditions.md\">why</a>). The log directory is an absolute path outside\nthe reviewed tree and every worktree of the checkout: a relative one lands the final review in the\ntree under review, and a log in a worktree gets committed and quoted by a later round. Wait for\nthe process to exit before reading anything, and keep its exit status: a reviewer that exited\nnon-zero did not finish a review.\n<strong>Complete when:</strong> the reviewer exited zero, and its full output is in the round&#39;s log file — or\nthe round is recorded as failed and run again as a new round.</p>\n</li>\n<li><p><strong>Read only the final review.</strong> A reviewer&#39;s log holds drafts, tool output and earlier messages\nbefore its final review, and it can quote old review files it found in the repository, so the\nreview has to be taken from a boundary nothing in the log can fake. The Codex CLI&#39;s exec form\nwrites the final message, and only that, to the file <code>-o</code> names: read that file. A reviewer\nthat only prints a log needs its final block cut out by a marker line, which is a fallback with a\nknown flaw — a quoted line that equals the marker restarts the cut and silently drops the\nfindings before it — so count the markers and compare the cut with the log by eye\n(<a href=\"references/review-record.md\">the review record</a> has both). A final review that is missing or\nempty is a <strong>failed round</strong>, not a clean one: nothing reads exactly like &quot;no findings&quot;. Nor is a\nreview that grades no finding clean on its face: a clean Codex review is plain prose, with no\ngrade and no fixed wording, so a person reads it and records it clean, or the round failed.\n<strong>Complete when:</strong> the reviewer exited zero, its final review is non-empty, the round&#39;s findings\ncome from it alone, and the record says how it was taken — the <code>-o</code> file, or a marker cut with\nits marker count — or the round is recorded as failed and run again.</p>\n</li>\n<li><p><strong>Check every finding against the code or the data before acting on it.</strong> A reviewer&#39;s claim\nabout the codebase can be wrong: a line that does not do what it says, a caller that does not\nexist, a case already handled two functions away. Read the cited code, then reproduce the\nproblem with an input that shows it. A claim that does not hold is rejected with the evidence.\nIt is not fixed to make the reviewer happy.\n<strong>Complete when:</strong> every finding is marked verified, with the reproducing input, or rejected,\nwith the evidence that refutes it.</p>\n</li>\n<li><p><strong>Fix every verified finding above the lowest severity.</strong> At the lowest severity, fix the cheap\nones and record the rest with a reason — in a round the next round will review. In the round\nthat stops the loop, step 12 decides instead. A severity is a judgement, not a measurement: the\nsame defect can be graded differently on two heads, so judge a lowest-severity finding on its\ncontent before deferring it.\nNothing above the lowest severity is deferred. An owner who disputes a grade re-scores the\nfinding explicitly, with the reason in the record — and until the finding is fixed or re-scored\nthat way, and a round&#39;s final review no longer grades it above the lowest, it blocks the stop\nrule and the merge.\n<strong>Complete when:</strong> every verified finding above the lowest severity is fixed, and every\nlowest-severity finding is fixed or recorded as deferred with a reason.</p>\n</li>\n<li><p><strong>Arm every fix: watch its check fail with the fix broken.</strong> Write a test or a self-check for\nthe fix. Copy the fixed file byte for byte to a scratch path, break the fix on purpose, run the\ncheck and watch it fail for the right reason, then restore from the byte copy and confirm the\nrestore by content before running the check again. Never restore with <code>git checkout --</code> or\n<code>git restore</code>: the fix is usually uncommitted in that same file, and the restore throws it away\nalong with the mutation, silently (<a href=\"references/arming-a-fix.md\">arming a fix</a>).\n<strong>Complete when:</strong> every fix has a recorded failing run under a named mutation and a passing\nrun after a restore checked with <code>cmp</code> or a search for the fix&#39;s own identifier.</p>\n</li>\n<li><p><strong>Diff shared code against the base after every fix.</strong> A fix aimed at one path often runs\nthrough a function every path shares, and can quietly change what the default path does — a\nguard added for an edge case that also rewrites the ordinary case.\n<strong>Complete when:</strong> every shared function the round touched has been diffed against the base,\nand each change to its default behaviour is intended and tested.</p>\n</li>\n<li><p><strong>Measure each finding&#39;s effect on any published result.</strong> Where the pull request publishes\nnumbers, rerun them with the fix and compare them with the published ones. Write &quot;no effect&quot;\nonly when that comparison shows no change, and name the command that showed it.\n<strong>Complete when:</strong> every finding has an effect line — the numbers that moved, from what to what,\nor &quot;none&quot;, backed by a named command and its output.</p>\n</li>\n<li><p><strong>Run the tests and the reproduce script on the fixed tree.</strong>\n<strong>Complete when:</strong> both have run on the last fix commit, and their results are in the record.</p>\n</li>\n<li><p><strong>Write the round&#39;s review record.</strong> The head reviewed, the reviewer command, and for each\nfinding its severity and title as the reviewer gave them, whether it was verified, its\ndisposition, its armed evidence, its effect, and the commit that fixed it. A correction to an\nearlier round&#39;s record is written as a correction in this one. The earlier record is never\nedited to look as though it had always been right. Put the record where it does not move the\nhead under review: on the pull request, as a comment or a section of its description. A\nrepository that keeps records as files commits each one after the fixes it describes, never\nwith them — a file cannot name the commit that adds it — so the next round reviews it along\nwith them. The last round&#39;s record always goes on the pull request: a commit after the last\nreview is a head nobody reviewed.\n<strong>Complete when:</strong> every finding in the last block appears in the record, and the record is on\nthe pull request or in a commit after the fixes it names.</p>\n</li>\n<li><p><strong>Push, and review the new head.</strong> The fixes are new code and get their own round.\n<strong>Complete when:</strong> the next round is pinned to the pushed head, or the stop rule below applies.</p>\n</li>\n<li><p><strong>Stop when a round returns only lowest-severity findings, and leave a reviewed head to merge.</strong>\nThat round reviewed its head and nothing after it, so any commit made now is unreviewed. Take\none of two exits:</p>\n<ul>\n<li><strong>Defer and merge.</strong> Record every finding as deferred, with where it is tracked, and merge the\nhead that round reviewed. The records go in the round&#39;s dispositions file, one complete line\nper finding, which the merge checklist reads.</li>\n<li><strong>Fix, then confirm once.</strong> Fix the findings worth fixing, armed as in step 6, push, and run\none confirmation round on the new head. If it returns nothing above the lowest severity, that\nhead is the one that merges, and anything it reports at the lowest severity is deferred, not\nfixed — a fix would need another round, and the loop would not end. If it returns anything\nabove the lowest severity, the loop resumes at step 4 on that head.</li>\n</ul>\n<p><strong>Complete when:</strong> the head that will merge is the head of a round that returned only\nlowest-severity findings — the stop round&#39;s, or its one confirmation round&#39;s — with no commit\nafter it, and every finding from that round is recorded as deferred with its tracking, or\nrejected with its evidence.</p>\n</li>\n<li><p><strong>Split the pull request when rounds keep finding new kinds of bug.</strong> Rephrasings of one defect\nconverge. A run of rounds that each find a class of defect no earlier round found — the same\nsubsystem failing in a new way each time — does not converge, and the next round will find\nanother. After about three such rounds, stop iterating: propose a split that moves the\nsubsystem that keeps failing into its own pull request, and let the owner decide.\n<strong>Complete when:</strong> the split is proposed with the classes found so far, or the rounds are\nconverging and the record shows it.</p>\n</li>\n<li><p><strong>Merge only the head that was reviewed and checked, by hand, after a checklist.</strong> Merging is a\nperson&#39;s act, and this skill ships no merge script: three rounds running found a new way for a\nscripted gate to merge what nobody reviewed. Check each line, and stop at the first that fails\n(<a href=\"references/merge-preconditions.md\">merge preconditions</a> says why each one is there):</p>\n<ol>\n<li>The pull request&#39;s head is the sha the final round reviewed (<code>round-&lt;n&gt;.head</code>) — under\nstep 12, the stop round&#39;s or its one confirmation round&#39;s — with no commit after it.</li>\n<li>No earlier round that did not end the loop reviewed that same head, unless every finding it\ngraded above the lowest was rejected with evidence. A defect a round found is fixed in a new\nhead, never reviewed away by running the review again until a run comes back clean.</li>\n<li>Every finding of the final round has a complete disposition in <code>round-&lt;n&gt;.dispositions</code>; a\nreview that graded none was recorded <code>clean:</code> by the person who read it, or the round failed.</li>\n<li>The base branch&#39;s live tip (<code>git ls-remote origin refs/heads/&lt;base&gt;</code>) is the base the round\nrecorded (<code>round-&lt;n&gt;.base</code>). If it moved, review again; <code>baseRefOid</code> does not see it move.</li>\n<li>It targets the branch it should, not a base that merged and is gone, and it is mergeable.</li>\n<li>Every required check completed and passed on that exact commit: a zero exit, a non-empty\nlist, every one passed. No checks is not a pass, and a conflicting pull request gets none.</li>\n<li>The pull request did not configure its own review: the round ran the reviewer with the tree&#39;s\ninstructions off, or a person read every change the diff makes to instruction files, symbolic\nlinks and reviewer configuration, and recorded that in the round&#39;s record.</li>\n</ol>\n<p>Then merge with the head pinned, so that a push in between fails the merge instead of merging\nunreviewed code: <code>gh pr merge &lt;n&gt; --merge --match-head-commit &lt;reviewed sha&gt;</code>.\n<strong>Complete when:</strong> every line held and the merge ran with <code>--match-head-commit</code> set to the\nreviewed head — or a line failed, and the record says which.</p>\n</li>\n</ol>\n<h3 id=\"usage-examples\">Usage Examples</h3>\n<pre><code class=\"language-text\">Run codex review on this PR against origin/main in the background, writing to a file. Read only the\nfinal review. Fix every P0, P1 and P2 with a check you have watched fail, write the round&#39;s\nreview record, and go again until a round comes back with only P3s.\n</code></pre>\n<pre><code class=\"language-text\">The reviewer says the parser drops empty rows. Before you change anything, show me that it is true:\nthe line it means, and an input that proves it.\n</code></pre>\n<pre><code class=\"language-text\">This PR changes numbers in a published report. For every finding, tell me whether fixing it moves a\npublished number, and by how much. Do not write &quot;no effect&quot; unless you measured it.\n</code></pre>\n<pre><code class=\"language-text\">That is the fourth round in a row that found a new kind of bug. Stop iterating, and propose how to\nsplit this PR so that the part that keeps failing gets its own branch.\n</code></pre>\n<pre><code class=\"language-bash\"># Fail fast: a command that fails stops the recipe, so nothing after it runs on a false premise —\n# no review of a tree that was never fetched, no round counted after a failed review.\nset -euo pipefail\n\n# One round of review. It never merges: the merge is a person&#39;s act, after step 14&#39;s checklist.\n# REVIEW_LOGS is absolute, outside the review tree and every worktree of this checkout.\n: &quot;${ROUND:?set ROUND to the number of this round}&quot;\n: &quot;${REVIEW_LOGS:?set REVIEW_LOGS to an absolute directory outside the repository}&quot;\ncase &quot;$REVIEW_LOGS&quot; in /*) ;; *) echo &quot;REFUSE: REVIEW_LOGS must be an absolute path&quot;; exit 1;; esac\n\n# A round counts only if the reviewer exited zero AND wrote a non-empty final review, which the exec\n# form writes, and only that, to the file -o names: no log marker can cut it. A failed round leaves none.\nreview_round() {  # review_round &lt;n&gt; &lt;tree&gt; &lt;base sha&gt;\n  local tree_abs listed wt wt_abs logs_abs log final\n  case &quot;$REVIEW_LOGS&quot; in /*) ;; *) echo &quot;ROUND $1 REFUSED: REVIEW_LOGS must be an absolute path&quot;; return 1;; esac\n  # The reviewer gets the recorded sha, never a name it would resolve for itself when it starts.\n  [[ &quot;${3:-}&quot; =~ ^[0-9a-f]{40}([0-9a-f]{24})?$ ]] || { echo &quot;ROUND $1 REFUSED: the base must be the recorded sha, not a name&quot;; return 1; }\n  tree_abs=$(cd &quot;$2&quot; &amp;&amp; pwd -P) &amp;&amp; mkdir -p &quot;$REVIEW_LOGS&quot; &amp;&amp; logs_abs=$(cd &quot;$REVIEW_LOGS&quot; &amp;&amp; pwd -P) || return 1\n  # The reviewed tree, then every worktree of this checkout, the checkout included. NUL-delimited (-z,\n  # git 2.36+): a path may hold a newline. A list git did not finish has no END record, and refuses.\n  while IFS= read -r -d &#39;&#39; wt; do\n    case $wt in END) listed=yes; continue;; &quot;worktree &quot;*) wt=${wt#worktree };; *) continue;; esac\n    wt_abs=$(cd &quot;$wt&quot; 2&gt;/dev/null &amp;&amp; pwd -P) || wt_abs=$wt\n    case &quot;$logs_abs/&quot; in &quot;$wt_abs&quot;/*|&quot;$wt&quot;/*) echo &quot;ROUND $1 REFUSED: REVIEW_LOGS is inside the reviewed tree or a worktree of this checkout: $wt&quot;; return 1;; esac\n  done &lt; &lt;(printf &#39;worktree %s\\0&#39; &quot;$tree_abs&quot;; git worktree list --porcelain -z &amp;&amp; printf &#39;END\\0&#39;)\n  [ &quot;${listed:-}&quot; = yes ] || { echo &quot;ROUND $1 REFUSED: git could not list this checkout&#39;s worktrees&quot;; return 1; }\n  # The reviewer takes nothing from the tree: -c turns off its instruction files; these two no flag does.\n  for wt in .codex .agents; do if [ -e &quot;$2/$wt&quot; ] || [ -L &quot;$2/$wt&quot; ]; then echo &quot;ROUND $1 REFUSED: the reviewed tree holds $wt, which configures its reviewer&quot;; return 1; fi; done\n  log=&quot;$logs_abs/round-$1.log&quot;; final=&quot;$logs_abs/round-$1.final.txt&quot;\n  rm -f &quot;$final&quot; &quot;$logs_abs/round-$1.dispositions&quot;  # nothing from an earlier run stands in for this one\n  (cd &quot;$2&quot; &amp;&amp; codex exec review -c project_doc_max_bytes=0 --base &quot;$3&quot; -o &quot;$final&quot;) &gt; &quot;$log&quot; 2&gt;&amp;1 &amp;\n  wait $! || { rm -f &quot;$final&quot;; echo &quot;ROUND $1 FAILED: the reviewer exited non-zero; not a clean round&quot;; return 1; }\n  grep -q &#39;[^[:space:]]&#39; &quot;$final&quot; 2&gt;/dev/null \\\n    || { rm -f &quot;$final&quot;; echo &quot;ROUND $1 FAILED: no final review was written; not a clean round&quot;; return 1; }\n}\n\n# A round is terminal only if every grade in its final review is the lowest of the declared scale, for\n# the Codex CLI P3. Any other grade, above it or outside the scale (a P4), is not: never merge on it.\nterminal_round() {  # terminal_round &lt;n&gt;\n  local final=&quot;$REVIEW_LOGS/round-$1.final.txt&quot; other\n  [ -s &quot;$final&quot; ] || { echo &quot;NOT TERMINAL: round $1 has no final review&quot;; return 1; }\n  other=$(grep -Eo &#39;\\[P[0-9]+\\]&#39; &quot;$final&quot; | sort -u | grep -vx &#39;\\[P3\\]&#39; || true)\n  [ -z &quot;$other&quot; ] || { echo &quot;NOT TERMINAL: round $1 grades findings other than the lowest, P3:&quot; $other; return 1; }\n}\n\n# HEAD is the sha and git lists nothing, ignored files included. A git that failed proves nothing: fail.\nexact_tree() {  # exact_tree &lt;tree&gt; &lt;sha&gt;\n  local head status; head=$(git -C &quot;$1&quot; rev-parse HEAD) &amp;&amp; status=$(git -C &quot;$1&quot; status --porcelain --ignored) || return 1\n  [ &quot;$head&quot; = &quot;$2&quot; ] &amp;&amp; [ -z &quot;$status&quot; ]\n}\n\n# A round number is reserved atomically, by mkdir, and never reused. Review exactly the pushed bytes in a\n# fresh detached worktree, never the checkout, whose ignored files `git status --porcelain` hides.\nmkdir -p &quot;$REVIEW_LOGS&quot; &amp;&amp; mkdir &quot;$REVIEW_LOGS/round-$ROUND.lock&quot; 2&gt;/dev/null || { echo &quot;REFUSE: round $ROUND is taken: it ran, or is running; review as a new round&quot;; exit 1; }\ngit fetch origin\nsha=$(git rev-parse &#39;@{upstream}&#39;); base=$(git rev-parse origin/main)\nscratch=$(mktemp -d &quot;${TMPDIR:-/tmp}/review-tree.XXXXXX&quot;); tree=&quot;$scratch/tree&quot;\ntrap &#39;git worktree remove --force &quot;$tree&quot; 2&gt;/dev/null || rm -rf &quot;$tree&quot;; rm -rf &quot;$scratch&quot;; git worktree prune&#39; EXIT\ngit worktree add --detach &quot;$tree&quot; &quot;$sha&quot;\nexact_tree &quot;$tree&quot; &quot;$sha&quot; || { echo &quot;REFUSE: the review tree is not exactly $sha&quot;; exit 1; }\nreview_round &quot;$ROUND&quot; &quot;$tree&quot; &quot;$base&quot;    # a failed round stops here, before anything is pinned\n# Check again: a reviewer that wrote into the tree, built there or moved HEAD reviewed something else.\nexact_tree &quot;$tree&quot; &quot;$sha&quot; || { rm -f &quot;$REVIEW_LOGS/round-$ROUND.final.txt&quot;; echo &quot;ROUND $ROUND FAILED: the review tree changed while it was reviewed, or git could not tell; nothing is pinned&quot;; exit 1; }\necho &quot;$sha&quot; &gt; &quot;$REVIEW_LOGS/round-$ROUND.head&quot;; echo &quot;$base&quot; &gt; &quot;$REVIEW_LOGS/round-$ROUND.base&quot;\nterminal_round &quot;$ROUND&quot;          # so does a round with P0-P2 findings left\necho &quot;Round $ROUND is terminal. Record a complete disposition per finding in round-$ROUND.dispositions; a review&quot;\necho &quot;that grades none failed, unless you read it and record it clean:. Then work through step 14&#39;s checklist.&quot;\n</code></pre>\n<h3 id=\"what-it-looks-like\">What it looks like</h3>\n<p>A specimen, not a prompt.</p>\n<h4 id=\"a-rounds-review-record\">A round&#39;s review record</h4>\n<pre><code class=\"language-text\">Review round 3 — PR &lt;number&gt; — head &lt;sha&gt; against origin/main at &lt;base sha&gt; — posted on the PR\nReviewer: codex exec review -c project_doc_max_bytes=0 --base &lt;base sha&gt; -o &lt;file&gt;; final review from -o\n\n[P1] The scorer counts a &quot;does not apply&quot; answer as an invention\n  verified: yes — &lt;file&gt;:&lt;line&gt;; fixture item &lt;id&gt; reproduces it\n  disposition: fixed in &lt;sha&gt;\n  armed: test &quot;not-applicable is not invention&quot; failed with the fix broken; passed after a\n         restore from a byte copy, checked with cmp\n  effect: arm B invention &lt;x&gt;% -&gt; &lt;y&gt;% (reproduce.sh, tables/bar-2.csv); bar 2 verdict unchanged\n\n[P1] &quot;The loader skips the header row twice&quot;\n  verified: no — the header is read once (&lt;file&gt;:&lt;line&gt;); a fixture with a header and one row\n            loads one row\n  disposition: rejected, evidence above\n  effect: none — nothing was changed; reproduce.sh output byte-identical at this head\n\n[P3] A log line misspells an arm label\n  verified: yes — &lt;file&gt;:&lt;line&gt; prints &quot;arm-B&quot; where the label is &quot;arm B&quot;\n  disposition: fixed (cheap) in &lt;sha&gt;\n  armed: test &quot;log lines use the arm&#39;s label&quot; failed with the fix broken; passed after a restore\n         from a byte copy, checked with cmp\n  effect: none — reproduce.sh output byte-identical before and after\n\nTests: &lt;command&gt; — all passing at &lt;sha&gt;. reproduce.sh: identical except tables/bar-2.csv, as above.\nCorrection to round 2: its P1 on the cache key was marked fixed in &lt;sha&gt;; that commit fixed the\nread path only. The write path is fixed in this round, in &lt;sha&gt;.\nNext: round 4 on &lt;sha&gt;, the last fix commit, once pushed.\n</code></pre>\n<p>Every finding has a verified line and an effect line, and every fix an armed line: the record meets\nthe contract it describes. Each finding says whether it was true, what was done, how the fix was\nproven to matter, and what it changed in the published numbers. The rejected finding carries its evidence. The correction to the\nearlier round is stated where the reader will see it.</p>\n<h3 id=\"pitfalls\">Pitfalls</h3>\n<ul>\n<li><strong>Reading the whole log.</strong> Drafts, tool output and quoted old reviews precede the final block. In\none loop the reviewer printed review files it found in the repository, and an extraction that\nbegan at the first block presented three earlier rounds&#39; findings as the current one&#39;s.</li>\n<li><strong>Fixing a claim nobody checked.</strong> A reviewer is often right and sometimes confidently wrong\nabout what the code does. An unverified &quot;fix&quot; for a defect that does not exist is a real change\nwith no reason behind it.</li>\n<li><strong>A fix whose check never failed.</strong> A test written after the fix and green from its first run\nproves that it runs, not that it guards anything.</li>\n<li><strong>Restoring a mutation with version control.</strong> <code>git checkout --</code> restores the last committed\nversion, which predates the uncommitted fix. The fix disappears, the suite still passes because\nits own test went with it, and nothing reports either.</li>\n<li><strong>&quot;No effect&quot; with no measurement.</strong> It reads as a finding and is a guess. Published numbers are\nexactly where an unmeasured guess does the most damage.</li>\n<li><strong>A fix that changes the default path.</strong> A shape guard added for an override path can change\nwhat the ordinary path does with an edge input, and no finding pointed there.</li>\n<li><strong>Rounds that do not converge.</strong> Each finds a new class of defect, each fix adds surface, and the\nnext round finds the next class. The way out is a smaller pull request, not another round.</li>\n<li><strong>Severity as a verdict.</strong> The same defect has been graded high on one head and lower on the\nnext, and the check went green with the defect still in place. Judge the content, and fix a head\ngraded above the lowest; do not review it again until a run grades it lower.</li>\n<li><strong>A marker the review itself can contain.</strong> Cutting the final block out of a log at the last line\nreading <code>codex</code> breaks the moment the review quotes a file or a command output with such a line:\nthe cut restarts there and the findings before it vanish, while the tail left over still looks\nlike a review. Take the final message from a file the reviewer writes, where it has one.</li>\n<li><strong>A failed round read as a clean one.</strong> A reviewer that crashed, was rate-limited or was logged\nout leaves a log with no final block, and an extraction over it returns nothing — which looks\nexactly like a review with no findings. A round counts only on a zero exit and a non-empty final\nblock.</li>\n<li><strong>A dirty tree under review.</strong> The reviewer reads the files in front of it. An edit made after\nthe push, or a file never committed, is reviewed and then never merged, and a commit not yet\npushed is merged without the review having seen it on the branch. A checkout that holds only\nignored files looks clean to <code>git status --porcelain</code> and is not. Review a fresh worktree at the\npushed sha, and remove it when the round ends: rounds that leave theirs pile up. A tree clean\nbefore the review says nothing about the tree the reviewer left: check it again after it exits.</li>\n<li><strong>A base that moved after the review.</strong> The head pin does not cover it, and <code>baseRefOid</code> does\nnot see it: on one open pull request it named a base 17 commits behind the base branch&#39;s tip,\nand the pull request read <code>MERGEABLE</code>. Compare the branch&#39;s live tip with the round&#39;s base.</li>\n<li><strong>The lowest grade taken from memory.</strong> One reviewer&#39;s scale ends at P2 and another&#39;s at P3. A\nthreshold copied from the wrong one stops the loop a grade early and leaves a whole grade of\nfindings unfixed. Read the scale from the reviewer.</li>\n<li><strong>A scripted merge gate.</strong> Three rounds running found a new way for one to merge what nobody\nreviewed: findings not yet read, a base that moved, a reused round, a head reviewed again until a\nrun came back clean. Merge by hand after the checklist, pinned with <code>--match-head-commit</code>. And\n<code>gh pr checks --json</code> exits zero even when a check has failed: read the buckets.</li>\n<li><strong>Merging a head nobody reviewed.</strong> A last &quot;trivial&quot; fix pushed after the final round merges\nunreviewed and unchecked unless the merge is pinned to the reviewed head. The commonest version\nis the stop round&#39;s own lowest-severity findings, fixed &quot;because they were cheap&quot; and merged\nwithout the one confirmation round that would have reviewed them.</li>\n<li><strong>A record committed with the fixes it names.</strong> A file cannot carry the sha of the commit that\nadds it, and a record committed after the last round is itself an unreviewed head. Records go\non the pull request, or in a commit after the fixes that the next round then reviews.</li>\n<li><strong>Editing an earlier round&#39;s record.</strong> A record quietly corrected in place makes every other\nrecord untrustworthy. Corrections go forward, stated as corrections.</li>\n</ul>\n<h3 id=\"verification\">Verification</h3>\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> Each round names the head sha it reviewed and the base sha it diffed against, and the remote\nbranch pointed at the head.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Each round reviewed a fresh worktree at that sha whose <code>git status --porcelain --ignored</code>\nwas empty — never the checkout — and the worktree and its directory were removed after. The\ntree was checked again after the reviewer exited: <code>HEAD</code> still that sha, and nothing listed.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The reviewer ran in the background, given the recorded base sha rather than a branch name, to\na log directory outside every worktree of the checkout, and was read only after it exited.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Each round counted only on a zero exit and a non-empty final review; any other round was\nrecorded as failed and run again.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Each round&#39;s findings came from the reviewer&#39;s final message alone — the file its <code>-o</code>\noption wrote, or, for a reviewer with only a log, a marker cut checked against the log.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The threshold came from the reviewer&#39;s declared scale — for the Codex CLI, P0 to P3: P0 to\nP2 fixed, a P3-only round stops the loop.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Every finding was verified against the code or data, or rejected with evidence.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Every verified finding above the lowest severity was fixed; lowest-severity findings were\nfixed if cheap and otherwise recorded with a reason.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Every fix has a check that was watched failing with the fix broken, and passing after a\nrestore from a byte copy that was checked by content.</li>\n<li><input disabled=\"\" type=\"checkbox\"> No <code>git checkout --</code> or <code>git restore</code> was used to undo a mutation.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Shared code touched by a fix was diffed against the base, and default-path changes are\nintended and tested.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Every finding has an effect line, and every &quot;none&quot; names the command that measured it.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Tests and the reproduce script ran on the last fix commit of each round.</li>\n<li><input disabled=\"\" type=\"checkbox\"> A review record exists for every round, and corrections to earlier rounds are stated in\nlater records rather than edited into earlier ones.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The loop stopped on a round with only lowest-severity findings — or a split was proposed\nafter rounds kept finding new kinds of bug.</li>\n<li><input disabled=\"\" type=\"checkbox\"> At the stop, its findings were either all deferred and the reviewed head merged, or fixed\nand then reviewed by exactly one confirmation round, whose own lowest-severity findings were\ndeferred.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The merged head is the head of the stop round or of its one confirmation round, with no\ncommit after it; its base is the intended branch; and every required check completed and\npassed on that exact commit.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Every record is on the pull request, or in a commit after the fixes it names — none names\nits own commit, and none follows the last review.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The merge ran by hand after every line of step 14&#39;s checklist held: the reviewed head, not\nreviewed before by a round that did not end the loop; a complete disposition per finding, or\nthe review recorded clean; the recorded base still the branch&#39;s tip; the intended branch,\nmergeable; a non-empty, all-passed list of required checks from a zero-exit call; and the\nreviewer run with the tree&#39;s instructions off, or every change to instruction files, symbolic\nlinks and reviewer configuration read by a person and recorded.</li>\n<li><input disabled=\"\" type=\"checkbox\"> The merge used <code>--match-head-commit</code>.</li>\n</ul>\n<h3 id=\"deeper-reading\">Deeper reading</h3>\n<ul>\n<li><a href=\"references/review-record.md\">The review record</a>: extracting the final block, the record&#39;s\nfields, the dispositions and the file the merge checklist reads them from, and measuring an effect.</li>\n<li><a href=\"references/arming-a-fix.md\">Arming a fix</a>: the byte-copy mutation, why version control is the\nwrong restore, and how to confirm a restore by content.</li>\n<li><a href=\"references/merge-preconditions.md\">Merge preconditions</a>: why each line of the merge checklist is\nthere, the measured <code>gh</code> behaviours behind them, and the pinned merge.</li>\n</ul>\n","outline":["When to Use","Prerequisites","Procedure","Usage Examples","What it looks like","Pitfalls","Verification","Deeper reading"],"words":5863}
