<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PHPatch.com</title>
    <description>The latest articles on DEV Community by PHPatch.com (@phpatch).</description>
    <link>https://dev.to/phpatch</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4263059%2F20910c2f-42b2-47d7-abae-99a1a4346eea.png</url>
      <title>DEV Community: PHPatch.com</title>
      <link>https://dev.to/phpatch</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phpatch"/>
    <language>en</language>
    <item>
      <title>Why one model reviewing its own code isn't a review</title>
      <dc:creator>PHPatch.com</dc:creator>
      <pubDate>Tue, 24 Nov 2026 16:11:24 +0000</pubDate>
      <link>https://dev.to/phpatch/why-one-model-reviewing-its-own-code-isnt-a-review-gkd</link>
      <guid>https://dev.to/phpatch/why-one-model-reviewing-its-own-code-isnt-a-review-gkd</guid>
      <description>&lt;p&gt;If you let an AI agent write your code, who checks it?&lt;/p&gt;

&lt;p&gt;For most setups the answer is: the same model, or another instance of the same family, asked politely to "review the changes." It finds a few nits, says the code looks good, and you merge. That is not a review. It is the author reading their own draft.&lt;/p&gt;

&lt;p&gt;I ran into this building with coding agents, and it is why I wrote &lt;a href="https://github.com/PHPatch/codereview" rel="noopener noreferrer"&gt;CodeReview&lt;/a&gt;, an open-source review gate for AI-written code. Here is the reasoning behind it, including where it falls short.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three problems with self-review
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Shared blind spots.&lt;/strong&gt; A model that wrote a bug usually believes the bug is correct. Reviewers from other providers were trained on different data and fail in different ways, so they catch different things. Independence is the point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. An opinion is not a gate.&lt;/strong&gt; "LGTM" from a model is text. Nothing stops a flaky or flattering reviewer from waving a change through. A gate needs a rule: structured findings go in, a verdict comes out, and the same findings always give the same verdict.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Claims without evidence.&lt;/strong&gt; Models invent problems and invent fixes. If a finding has to quote the diff verbatim, you can check that quote with plain string matching. A finding that cannot be tied to the actual code should go to a human, not silently block or silently pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  How CodeReview works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder --diff--&amp;gt; deterministic checks --&amp;gt; reviewer A (correctness/security)
                  (secrets, injection,           |
                   data-loss, your tests)        v
                                          reviewer B (operations/reliability)
                                                 |
                          gate &amp;lt;-----------------+
                          PASS / BLOCKED / INCONCLUSIVE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;A panel of models from different providers (OpenAI, Gemini, Anthropic, DeepSeek and others, or any OpenAI-compatible endpoint) reviews the diff.&lt;/li&gt;
&lt;li&gt;Findings are merged across reviewers. Agreement raises confidence but never lowers severity.&lt;/li&gt;
&lt;li&gt;A fixed rule decides: &lt;strong&gt;PASS, BLOCKED, or INCONCLUSIVE&lt;/strong&gt;. The builder cannot approve its own work.&lt;/li&gt;
&lt;li&gt;A blocker raised by one vendor family is put to a reviewer from another family. A refutation only counts if it carries a validated quote.&lt;/li&gt;
&lt;li&gt;Your tests, lint and static analysis run in a sandbox and the results are stored with hashes, so the verdict does not rest on what a model claims.&lt;/li&gt;
&lt;li&gt;Everything is recorded: failed providers, fallback seats, degraded runs. Nothing is quietly swapped.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It ships as a CLI and an MCP server, so your coding agent can submit its own work to the gate before merge.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install codereview-loop

&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;...
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;...

codereview --repo . --staged --provider gemini --provider openai
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;   &lt;span class="c"&gt;# 0 = PASS, 1 = BLOCKED, 2 = INCONCLUSIVE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You bring your own keys and pick your own models. Your code goes to the providers you chose and nowhere else.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest numbers
&lt;/h2&gt;

&lt;p&gt;The repo ships a labelled benchmark corpus (36 cases, public and holdout splits) and the harness to score any panel. The headline metric is the escaped-defect rate: defects the gate would have shipped.&lt;/p&gt;

&lt;p&gt;The default &lt;code&gt;strict&lt;/code&gt; profile caught all 7 of 7 seeded defects in registered confirmation testing. That is a small sample: the 95% interval is [0.646, 1.000]. It also blocked 32 of 34 clean changes (95% interval [0.809, 0.984]), and that registered confirmation &lt;strong&gt;failed&lt;/strong&gt; its clean-change threshold. That is a real cost. Strict is for code you cannot afford to get wrong, and it has a documented waiver path. A &lt;code&gt;balanced&lt;/code&gt; profile exists, and an opt-in &lt;code&gt;corroborated&lt;/code&gt; profile failed its registered confirmation, so it is marked dev-only. The record is in the repo under &lt;code&gt;bench/generation-v2/RESULTS-2026-11-05.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I would rather publish that trade-off than a flattering number. If you work on solo or small-team projects, the false-positive rate is the thing I most want feedback on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it fits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Solo developers and small teams shipping code that an agent wrote.&lt;/li&gt;
&lt;li&gt;A pre-merge step your agent calls through MCP.&lt;/li&gt;
&lt;li&gt;A GitHub PR reviewer: &lt;code&gt;--post&lt;/code&gt; adds the report as a PR review comment (it never auto-approves) and sets a commit status.&lt;/li&gt;
&lt;li&gt;SARIF export, so findings show up in GitHub code scanning.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/PHPatch/codereview" rel="noopener noreferrer"&gt;https://github.com/PHPatch/codereview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PyPI: &lt;code&gt;pip install codereview-loop&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;MCP registry: &lt;code&gt;io.github.PHPatch/codereview&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;License: MIT&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try it on a real change, I would like to hear what it blocked that it should not have, and what it let through. Open an issue or leave a comment below.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: this article was written with AI assistance and reviewed before publishing. The benchmark figures come from the project's own repo.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>python</category>
      <category>mcp</category>
    </item>
  </channel>
</rss>
