From dd425adf6b2f27cf3ad14006d781a1b5c5ab2abd Mon Sep 17 00:00:00 2001 From: Verso Labs Date: Fri, 4 Sep 2026 15:08:01 -0300 Subject: [PATCH] fix: make native review JSON contract explicit --- plugins/codex/scripts/codex-companion.mjs | 6 +++++- tests/runtime.test.mjs | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/codex/scripts/codex-companion.mjs b/plugins/codex/scripts/codex-companion.mjs index 83df468ad..b6f41cb2b 100644 --- a/plugins/codex/scripts/codex-companion.mjs +++ b/plugins/codex/scripts/codex-companion.mjs @@ -382,7 +382,11 @@ async function executeReviewRun(request) { stderr: result.stderr, stdout: result.reviewText, reasoning: result.reasoningSummary - } + }, + result: null, + rawOutput: result.reviewText, + parseError: "The built-in reviewer returns prose; use adversarial-review for structured output.", + reasoningSummary: result.reasoningSummary }; const rendered = renderNativeReviewResult( { diff --git a/tests/runtime.test.mjs b/tests/runtime.test.mjs index 8f276835b..5270823e8 100644 --- a/tests/runtime.test.mjs +++ b/tests/runtime.test.mjs @@ -157,6 +157,23 @@ test("review renders a no-findings result from app-server review/start", () => { assert.match(result.stdout, /No material issues found/); }); +test("review --json explicitly reports that native review output is unstructured", () => { + const repo = makeTempDir(); + const binDir = makeTempDir(); + installFakeCodex(binDir); + initGitRepo(repo); + fs.writeFileSync(path.join(repo, "README.md"), "hello\n"); + run("git", ["add", "README.md"], { cwd: repo }); + run("git", ["commit", "-m", "init"], { cwd: repo }); + fs.writeFileSync(path.join(repo, "README.md"), "hello again\n"); + const result = run("node", [SCRIPT, "review", "--json"], { cwd: repo, env: buildEnv(binDir) }); + assert.equal(result.status, 0, result.stderr); + const payload = JSON.parse(result.stdout); + assert.equal(payload.result, null); + assert.equal(payload.rawOutput, payload.codex.stdout); + assert.match(payload.parseError, /built-in reviewer.*prose.*adversarial-review/i); +}); + test("task runs when the active provider does not require OpenAI login", () => { const repo = makeTempDir(); const binDir = makeTempDir();