Review this generated gate before it decides whether agent patches may be delivered.
Run one or more configured test commands without shell interpretation, reject an empty command list, require structured passing test counts, enforce path-aware workspace containment, bound captured output, and return auditable evidence.
JavaScript
import { exec } from "node:child_process";
import { promisify } from "node:util";
const run = promisify(exec);
export async function gate(task) {
const results = [];
for (const command of task.commands) {
const { stdout, stderr } = await run(command, { cwd: task.cwd });
results.push({ command, stdout, stderr });
}
const passed = results.every((result) =>
result.stdout.includes("pass"));
const inScope = task.changedFiles.every((file) =>
file.startsWith(task.workspace));
return {
ok: passed && inScope,
evidence: results.map(({ command, stdout }) => ({ command, stdout })),
};
}
generated code is illustrative, not from any one model