Essay · August 28, 2026

Code review for less than a cent

How I built an automated code review loop for less than a cent per change, paired with automated tests and a human approval step before anything ships.

Every change I ship goes through review before it reaches production. I want that first review right away, and I want a fresh one after every fix. Running a top-tier AI model on every revision gets expensive fast, so I built a cheaper loop in the Public Parish repository using open-source PR-Agent, GitHub Actions, and GLM 5.3 Flash.

In my first full test, three model calls cost less than half a cent. Even at the regular rate, a full pass stays under a cent. At that price, a fresh review runs automatically after every fix instead of treating the first pass as final.

How the work splits

Three pieces split the release work so no single tool carries the whole load. First, GitHub Actions runs standard automated checks: typechecking, tests, the production build, and lint. Those checks catch mechanical failures a model should never guess at. Second, PR-Agent reads the full change alongside the repository's rules, writes a summary, scores the change, and updates the same review thread on each new push instead of piling up old comments. Third, GLM 5.3 Flash supplies the model reasoning through OpenRouter.

Permissions stay narrow. The workflow gets read-only access to the code and write access only to review comments, with restricted mode turned on so it can never alter files or merge a branch. One limit is worth stating plainly: the review still goes to an external model. OpenRouter and the serving provider see the change, so running the workflow inside your own repository does not keep the code private.

What it cost and what it caught

Because code review runs in the background, chat speed barely matters. Cost and enough room to read a whole change matter more. On August 28, 2026, OpenRouter listed GLM 5.3 Flash at $0.075 per million input tokens and $0.25 per million output tokens during a limited Z.ai discount, and $0.15 and $0.50 at the regular Z.ai rate. That puts a review pass under half a cent on discount and under a cent at full price.

To test the loop, I opened a throwaway pull request with two planted targets: an impossible date, 2026-02-30, and a decoy written to bait the model into a false alarm. The reviewer caught the bad date, ignored the decoy, and scored the pass at 85. After I pushed the fix, it re-ran on its own, cleared the finding, and raised the score to 92. That first end-to-end run took 2 minutes and 25 seconds.

The real test came on the first production evidence release. PR-Agent spotted Lafayette-specific fallback queries and warned that future parishes would break. The warning sounded reasonable, yet it did not apply because that release only built the Lafayette registry and future parishes belonged in later work. Checking the comment against the code and the release scope kept the change clean without an unnecessary edit.

Where a person stays in charge

That single production warning shows why I never let a review bot change code on its own. My workflow treats every bot comment as unverified and checks it against the source code first. Real bugs get the smallest fix, false alarms get a written reply, and unrelated ideas stay out of the release. If a branch has not settled after three fix cycles or about thirty minutes, automation stops and hands the remaining issues back to a person.

Public Parish deploys to production as soon as code merges. Passing checks never grant permission to ship. Nothing merges until I give a clear yes, and after I approve, I verify the live deployment with an independent check. This setup came from a small field check, and I have not benchmarked GLM 5.3 Flash against every budget model. Even so, it clears the bar I needed: cheap enough to run on every push, backed by automated tests, and gated by a person before anything goes live.

If you want this kind of discipline on your own software, read about my contract engineering work or tell me about your business.

← All essays