From be0eeb201b4dbac8fa6e6d8e84514fdb88c44665 Mon Sep 17 00:00:00 2001 From: qybaihe <137127051+qybaihe@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:34:08 +0800 Subject: [PATCH] fix(redteam): emit unverified JSON when REA dist absent Keep CI soft-skip exit 0, but print bla-redteam-rea/v1 status unverified so agents never treat SKIP as a red-team pass. Harness covers the path. --- scripts/redteam/run.mjs | 10 ++++++++++ tests/redteam-harness.test.ts | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/scripts/redteam/run.mjs b/scripts/redteam/run.mjs index b728b15..7edf612 100755 --- a/scripts/redteam/run.mjs +++ b/scripts/redteam/run.mjs @@ -39,10 +39,20 @@ function tsharkVersion(env) { async function main() { if (!reaDistReady()) { + // Honest agent-facing status: exit 0 keeps CI green when REA is optional, + // but never imply a red-team pass. MCP bla_redteam_report uses the same word. console.log( "SKIP: sibling REA dist not ready (expected at ../rea or $REA_ROOT). " + "Red-team empirical gates require a local REA checkout; CI skips when absent.", ); + console.log( + JSON.stringify({ + schema: "bla-redteam-rea/v1", + status: "unverified", + reason: + "Sibling REA dist not ready — empirical redteam:rea did not run (not a pass).", + }), + ); process.exit(0); } const tshark = resolveTsharkEnv(); diff --git a/tests/redteam-harness.test.ts b/tests/redteam-harness.test.ts index a8fb74f..f51ab57 100644 --- a/tests/redteam-harness.test.ts +++ b/tests/redteam-harness.test.ts @@ -152,3 +152,27 @@ describe("WASM interface exhaustion vs representation budget", () => { ); }); }); + +describe("redteam:rea skip honesty", () => { + it("emits status unverified JSON when sibling REA dist is absent", async () => { + const { spawnSync } = await import("node:child_process"); + const { mkdtempSync } = await import("node:fs"); + const { tmpdir } = await import("node:os"); + const emptyRea = mkdtempSync(join(tmpdir(), "bla-no-rea-")); + const r = spawnSync(process.execPath, ["scripts/redteam/run.mjs"], { + cwd: process.cwd(), + encoding: "utf8", + env: { ...process.env, REA_ROOT: emptyRea }, + }); + expect(r.status).toBe(0); + expect(r.stdout).toMatch(/SKIP: sibling REA dist not ready/); + const line = r.stdout + .split("\n") + .map((s) => s.trim()) + .find((s) => s.startsWith("{") && s.includes("bla-redteam-rea")); + expect(line).toBeTruthy(); + const payload = JSON.parse(line!); + expect(payload.schema).toBe("bla-redteam-rea/v1"); + expect(payload.status).toBe("unverified"); + }); +});