Skip to content

The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.

fix(tools): treat a Codex review that could not run as no review

Zhuowei Wangda8725c626fc
diff --git a/tools/linear-autofix/src/codex.mjs b/tools/linear-autofix/src/codex.mjs
index 8f68807..f14d128 100644
--- a/tools/linear-autofix/src/codex.mjs
+++ b/tools/linear-autofix/src/codex.mjs
@@ -28,6 +28,22 @@ export function isCleanReview(body, cleanLine = config.codexCleanLine) {
return extractFindings(body).trim() === cleanLine;
}
+const FINDING_LINE = /^\s*-\s+\*\*\[(Blocker|Major|Minor|Nit)\]/m;
+
+/**
+ * 'clean' (the exact no-issues line), 'findings' (at least one severity
+ * bullet), or 'inconclusive' (anything else: the reviewer failed to run, hit
+ * a tooling problem, or produced free text). An inconclusive review is treated
+ * like no review at all, so the loop waits for the next run instead of
+ * "fixing" an apology.
+ */
+export function classifyReview(body, cleanLine = config.codexCleanLine) {
+ const text = extractFindings(body);
+ if (text.trim() === cleanLine) return "clean";
+ if (FINDING_LINE.test(text)) return "findings";
+ return "inconclusive";
+}
+
/** The review body without the marker, title and timestamp lines. */
export function extractFindings(body) {
return String(body ?? "")
diff --git a/tools/linear-autofix/src/codex.test.mjs b/tools/linear-autofix/src/codex.test.mjs
index 155abcb..5c9151b 100644
--- a/tools/linear-autofix/src/codex.test.mjs
+++ b/tools/linear-autofix/src/codex.test.mjs
@@ -1,6 +1,7 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import {
+ classifyReview,
extractFindings,
findCodexReview,
findingsFingerprint,
@@ -63,3 +64,10 @@ test("findingsFingerprint ignores sha, timestamp and line drift but not content"
),
);
});
+
+test("classifyReview tells clean, findings and a reviewer that could not run apart", () => {
+ assert.equal(classifyReview(clean("abcd1234")), "clean");
+ assert.equal(classifyReview(findings("abcd1234", 3)), "findings");
+ const failed = `<!-- codex-review -->\n\n## 🤖 Codex Review · \`abcd1234\`\n\n<sub>x</sub>\n\nI can't review the PR in this session because no shell tool is available.`;
+ assert.equal(classifyReview(failed), "inconclusive");
+});
diff --git a/tools/linear-autofix/src/review.mjs b/tools/linear-autofix/src/review.mjs
index fa26f7d..45bf00e 100644
--- a/tools/linear-autofix/src/review.mjs
+++ b/tools/linear-autofix/src/review.mjs
@@ -2,6 +2,7 @@ import path from "node:path";
import { config } from "./config.mjs";
import { loadPrompt, renderPrompt, runClaude } from "./claude.mjs";
import {
+ classifyReview,
extractFindings,
findCodexReview,
findingsFingerprint,
@@ -102,7 +103,17 @@ export async function review(issue, record) {
const { fresh: threads, awaitingHuman } = splitThreads(
await github.reviewThreads(pr.number),
);
- const codex = pr.isDraft ? null : findCodexReview(pr.comments, sha);
+ const codexComment = pr.isDraft ? null : findCodexReview(pr.comments, sha);
+ const inconclusive =
+ codexComment && classifyReview(codexComment.body) === "inconclusive";
+ const codex = inconclusive ? null : codexComment;
+ if (inconclusive) {
+ note(
+ record,
+ "codex review inconclusive",
+ extractFindings(codexComment.body).slice(0, 300),
+ );
+ }
const verdict = assessHead({
pr,
codex,