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.
This commit is contained in:
qybaihe
2026-11-03 03:34:08 +08:00
parent bf7a00308c
commit be0eeb201b
2 changed files with 34 additions and 0 deletions
+10
View File
@@ -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();
+24
View File
@@ -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");
});
});