{"slug":"pr-review-4","title":"pr-review","summary":"Stage 4 of 4 of the /la:pr flow — run /la:process-reviews in a loop until every source is green, then (OpenSpec repos only) archive the change, push, and keep looping on the archived HEAD until every source is green again so the PR can merge. Normally dispatched by /la:pr; if the","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:44:00.348118Z","repo":{"url":"https://github.com/MotleyAI/living-architecture","stars":16,"forks":2,"license":"MIT","updatedAt":"2026-11-27T11:19:06Z"},"bodyHtml":"<hr>\n<h2>name: pr-review\ndescription: Stage 4 of 4 of the /la:pr flow — run /la:process-reviews in a loop until every source is green, then (OpenSpec repos only) archive the change, push, and keep looping on the archived HEAD until every source is green again so the PR can merge. Normally dispatched by /la:pr; if the /la:pr context (BRANCH, CHANGE_ID, OPENSPEC, tracker issue) is not already loaded in this session, invoke the la:pr skill instead.</h2>\n<p><strong>Stage 4 of 4 of the <code>/la:pr</code> flow.</strong> Prerequisite: <code>/la:pr</code> has run in this\nsession, preflight included, and established <code>BRANCH</code>, <code>CHANGE_ID</code>, <code>OPENSPEC</code>, and the full tracker\nissue (body + comments, if there is one), and the PR for <code>BRANCH</code> exists. If any of that is\nmissing, invoke the <code>la:pr</code> skill instead — it rehydrates and dispatches back\nhere. The <code>/la:pr</code> stopping policy applies throughout this stage.</p>\n<p><strong>Stealth mode</strong> (<code>la-config get stealth</code> prints <code>true</code>): the <code>/la:pr</code> \"Stealth mode\" rules override every step\nbelow that writes to the tracker, writes OpenSpec or la files into the repo, runs an <code>openspec</code> command, commits,\npushes, or puts text in a commit, the PR or a reply.</p>\n<p><strong>Review sources.</strong> <code>la:process-reviews</code> owns everything per source: which bots\nare on this PR (<code>la-pr-reviewers</code>), waiting for them, fetching, validating, and\nhandling invalid findings. Every step below that names CodeRabbit or Sonar\napplies only when that bot is on the PR. Codex follows <code>reviewers.codex</code>: when\n<code>la-config get reviewers.codex</code> prints <code>false</code> there is no Codex gate; when it\nis on and the Codex MCP server (<code>mcp__codex__codex</code>) is missing, STOP and tell\nme — never skip it silently.</p>\n<h2>Step 1 — Review loop (batch local fixes; push only once per batch)</h2>\n<p>Do NOT re-run every gate after every micro-fix. Re-triggering the slow and\nquota-limited flows (CI, CodeRabbit, the Sonar PR gate) costs a full push\neach time. Batch fixes and verify them locally, then push once per batch.</p>\n<p><strong>Run this loop autonomously — fix findings and push fix batches without asking.\nThe ONLY pauses are (a) a nontrivial design choice — a real fork with more than\none reasonable option, raised with PROS/CONS + a recommendation per the\nsymptom-vs-structural rule below — and (b) the Step 2 archive gate. A flagged\ngate item is NEVER dismissed as \"pre-existing\": if a gate (Sonar, CI,\nconventions, the type baseline, …) flags something on this PR — even on an old\nline, an untouched file, or an issue with a months-old creation date — it is in\nscope. Fix it, or, only for a genuine false positive, suppress it through that\ngate's sanctioned channel with a written reason. \"It predates my change\" / \"the\ngate is still green overall\" is NEVER a reason to skip a flagged item.</strong></p>\n<p>Never ask before pushing to this PR's own branch: push as soon as a batch is\nready. Only opening a PR needs my approval.</p>\n<p>Split the gates into two tiers:</p>\n<ul>\n<li><strong>Local gates</strong> — fast, deterministic, need no push and no network trigger;\nrun against the working tree / local diff:\n<ul>\n<li>the tests in the <code>/la:pr</code> local test scope (which includes every test CI\nreported failing) and the linter (<code>la-config get commands.lint</code>, else the\nrepo's usual linter);</li>\n<li>conventions gate (<code>la-check-conventions &lt;PR&gt;</code>), handled as the\n<code>la:process-reviews</code> conventions gate section describes;</li>\n<li>type check (<code>trmv-typecheck</code>), under the ratchet rule described at the\ntype-check gate of the <code>la:pr-implement</code> skill;</li>\n<li>Codex on the local diff (<code>mcp__codex__codex</code>, read-only; when\n<code>reviewers.codex</code> is on) — it analyses the working tree, so it needs no push;</li>\n<li>local Sonar pre-check, before every push: <code>mcp__sonarqube__analyze_code_snippet</code> on each changed production source file (single-file only, a pre-filter, NOT a substitute for the pushed Sonar gate); fix its findings like any gate's. If the tool fails or is unavailable, ignore it;</li>\n<li><code>openspec validate &lt;CHANGE_ID&gt; --strict</code> (OpenSpec repos);</li>\n<li><strong>living-architecture repos</strong> (<code>architecture: true</code>): the\n<code>la:living-architecture</code> skill's \"Working under the architecture\" rules\napply to every fix in this loop. Then <code>la-arch-check</code> (the one import law, model-truth at every\ndeclared granularity) and LikeC4 model validation (see the\n<code>la:living-architecture</code> skill).</li>\n</ul>\n</li>\n<li><strong>Remote gates</strong> — slow and/or quota-limited; only a push produces them:\nCI (GitHub Actions), CodeRabbit, and the Sonar PR-decorated quality gate\n<ul>\n<li>new-issues count (the bots only when on the PR).</li>\n</ul>\n</li>\n</ul>\n<p>The loop:</p>\n<ol>\n<li><strong>Initial full sweep.</strong> Run <code>/la:process-reviews</code> on the current pushed HEAD. Fix each valid item in the working tree as soon as it is triaged, while the watch keeps running; push nothing. Run every local gate. When the watch exits, the failing set is complete.</li>\n<li><strong>Local fix sub-loop — NO push.</strong> Fix the failures, then re-run (a) the\nspecific gates that failed AND (b) every local gate above — INCLUDING a\nfresh full-PR Codex pass over the fixed working tree (Codex is a local\ngate: it reads the working tree, so a pre-push run costs no CI cycle;\ninclude uncommitted changes via <code>git diff origin/&lt;base&gt;</code>). Do NOT push and\ndo NOT re-trigger CI / CodeRabbit / Sonar in this sub-loop. Repeat\nuntil ALL local gates converge on the same tree state — tests, linter,\nconventions, type check, Sonar pre-check, openspec/architecture checks green\nAND Codex returning no new valid findings. NEVER push a fix Codex has not reviewed —\na gap in the fix itself otherwise ships and costs a full extra CI round.\nRun the local gates on these fixes as you go; the full convergence, Codex included, runs once the watch has exited.</li>\n<li><strong>Push once.</strong> Only after step 2 has fully converged (Codex included),\ncommit and push — this re-triggers the remote gates a single time for the\nwhole batch. Before every push, fetch and, when <code>origin/&lt;base&gt;</code> is not an\nancestor of HEAD, merge it (never rebase) and re-run the local gates. Reply\ndrafts <code>/la:process-reviews</code> returned go to me as one approval question\nbefore that push (or before reporting green when no push follows); post the\napproved ones with <code>la-reply-to-pr-thread</code> once the push is up, or at once\nwhen no push follows. Never push\nwhile a question to me is pending (or about to be asked) — ask first, push\nafter I answer, even if the batch excludes the disputed change.</li>\n<li><strong>Full remote sweep.</strong> Run <code>/la:process-reviews</code> again on the new HEAD (it also re-runs Codex), fixing each valid item as it is triaged, without pushing, until its watch exits. Any new failure sends you back to step 2, then step 3. Repeat until one full push cycle returns every source green with nothing left to fix.</li>\n</ol>\n<p><strong>\"Green\" for CI means an actually-COMPLETE, PASSING run — every check finished\nwith a pass conclusion.</strong> \"No <em>failed</em> checks\" is NOT green while any check is\nstill QUEUED / IN_PROGRESS, and <code>la-wait-for-reviews</code> exiting 0 only\nmeans the checks it saw were terminal at that poll — it can fire before slow\njobs (the full test matrix, integration/example jobs) even start or finish.\nBefore treating CI as green, confirm EVERY check shows <code>pass</code> (e.g.\n<code>gh pr checks &lt;PR&gt;</code>). NEVER declare convergence on an incomplete or\nstill-running CI run.</p>\n<p>Use <code>/la:process-reviews</code> for the remote sweeps (steps 1 and 4) — it owns the\nwatch + fetch of CI/CodeRabbit/Sonar and the Codex pass. Run the local\nsub-loop (step 2) directly against the working tree; do not invoke\n<code>/la:process-reviews</code> there (its watch is about remote state you have not\nre-triggered yet).</p>\n<p><strong>Symptom vs. structural cause — decide before you patch.</strong> For EACH valid\nfinding, before writing the fix, ask whether it is merely a <em>symptom</em> of a\ndeeper structural issue and whether a <em>structural</em> fix would be more correct\nthan a local band-aid — judged against the principles/axioms in the\n<code>architecture/*.arc42.md</code> files (a band-aid that leaves an axiom-violating\nshape standing, a bug that recurs because two code paths must agree by hand, a\nmissed-normalization that a single canonical representation would obviate, etc.\nare all tells). When a structural fix appears warranted, STOP and present the\ncase to me — the symptom, the structural cause, the band-aid vs. structural\noptions with PROS/CONS, the arc42 grounding, and your RECOMMENDATION — then wait\nfor my call (this is the design-decision pause permitted by the <code>/la:pr</code> stopping\npolicy). If the finding is genuinely local with no structural cause, just fix\nit. Never silently ship a band-aid over a structural problem, and never\nundertake a large structural refactor without my go-ahead.</p>\n<p><strong>Convergence also requires zero dangling CodeRabbit threads</strong> (CodeRabbit on\nthe PR): every thread <code>la:process-reviews</code> says needs a reply has one. \"All\nsources green\" alone is not enough.</p>\n<h2>Step 2 — Archive the OpenSpec change, then I merge (OpenSpec repos only)</h2>\n<p>Skip unless <code>OPENSPEC=1</code>. <strong>Archiving is the ONE action that ALWAYS needs my\nfresh, explicit say-so. It is NEVER covered by any \"keep going until clean\" /\n\"don't ask unless there's a design choice\" autonomy I grant — that autonomy is\nfor the fix loop (fixing findings, pushing fix batches) and STOPS at the archive.\nDo NOT archive on your own judgment, ever, even when every gate is green.</strong> Once\nthe Step 1 loop has CONVERGED — every source ACTUALLY green (CI a complete\npassing run per the definition above, Sonar, CodeRabbit, Codex, conventions,\ntype check) — do\nNOT archive: STOP, tell me the loop is clean, and ASK my permission to archive.</p>\n<p><strong>Before offering to archive, the branch MUST include the PR's base.</strong> If\n<code>git merge-base --is-ancestor origin/&lt;base&gt; HEAD</code> is false, merge it in\n(<code>git merge origin/&lt;base&gt;</code>, never rebase), re-run the Step 1 loop on the merged\ntree, and push. This is autonomous — do it without asking. Archiving a stale\nbranch bakes an out-of-date corpus into the merge.</p>\n<p><strong>Before you offer to archive, verify <code>openspec/changes/&lt;CHANGE_ID&gt;/tasks.md</code>\nhas no unchecked <code>- [ ]</code> items.</strong> <code>openspec archive</code> only <em>warns</em> on incomplete\ntasks and continues under <code>--yes</code>, so a silent gap would ship. For each\nunchecked task: tick it if the work is already done (a gate/verification task\nyou ran during the loop but never ticked is a common cross-session miss — tick\nit), do it if it is real remaining work, or — if it was deliberately deferred —\nstrike it with a one-line pointer to the issue it moved to. Do NOT offer to\narchive while a genuinely-incomplete task remains: surface the list to me and\nresolve it first, and when you do offer, report which unchecked tasks you ticked\nas already-done.</p>\n<p>Only on my explicit go-ahead run:</p>\n<pre><code>openspec archive &lt;CHANGE_ID&gt; --yes\n</code></pre>\n<p>and commit + push the result on the PR branch. Archiving pre-merge (NOT\npost-merge) lands the corpus update atomically with the code in the same PR.</p>\n<p><strong>The archive push re-triggers every remote gate. Keep reviewing until\nconvergence.</strong> The archive commit is docs-only, but CodeRabbit still reviews it\n(the new <code>openspec/specs/**</code> file is fresh text to it), and CI reruns. So after\nthe push, go back into the Step 1 loop on the archived HEAD: run\n<code>/la:process-reviews</code> for a full remote sweep, fix or answer every finding, push\neach fix batch, and sweep again. Repeat until one full push cycle is green on\nevery source, with zero dangling CodeRabbit threads. This applies equally to any\nlater push before the merge. Only then tell me the PR is ready to merge. NEVER\nreport \"ready to merge\" right after the archive push.</p>\n<p>The archive does not reopen the plan. A finding that would change the archived\nchange folder or <code>openspec/specs/**</code> beyond a pure typo is a plan edit. Present\nthe exact diff and wait for my OK, as the <code>/la:pr</code> frozen-plan rule requires.\nFixes to code and tests stay autonomous.</p>\n<p>This merges the delta into <code>openspec/specs/</code> (ADDED appended, MODIFIED replaced,\nREMOVED deleted) and moves the change to\n<code>openspec/changes/archive/YYYY-MM-DD-&lt;CHANGE_ID&gt;/</code>. Commit the result with one\n<code>git add</code> that names every changed <code>openspec/specs/</code> file and every moved file\nby explicit path, including the removed source paths under\n<code>openspec/changes/&lt;CHANGE_ID&gt;/</code>. This\nis the one step that keeps the behaviour corpus current — everything upstream is\nbest-effort authoring; <code>validate</code> (in <code>pr-plan</code>) and <code>archive</code> here are\nthe deterministic guarantees.</p>\n","files":[{"path":"SKILL.md","sizeBytes":12371,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:46:07.441132Z","sha256":"ABD031296F90B48D6F814471DDF7D77A72506B9D8594721D35B7BD62CCDADCE5","sizeBytes":5485},"review":null,"source":{"repositoryUrl":"https://github.com/MotleyAI/living-architecture","path":"plugin/la/skills/pr-review","license":"MIT","commit":"c1ecf0af05da41d754e0a83233334edf6cbca797","subtreeSha":"42C2F995FD9B4C2E67F9825B16435FFDAD62C27D76942339DB0FA402955579A7","lastSyncedAt":"2026-11-29T00:43:57.908191Z"},"reviewedAt":"2026-11-29T00:52:55.955043Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/MotleyAI/living-architecture/tree/main/plugin/la/skills/pr-review"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install motleyai-living-architecture@llmmart"},{"target":"git","command":"git clone https://github.com/MotleyAI/living-architecture.git"}]}