fix(eval,ci): isolate interview eval and harden skill lint and design gate
- Run eval sessions in a temp dir outside the repo so Codex no longer reads the root AGENTS.md; empty streams, timeouts and crashes judge as ERROR instead of PASS - Close interview-gate lint gaps: softening phrases hidden on allowed lines, reordered phrasing, sibling-anchor bypass - design-gate: bold threshold 700, axe incomplete reported as manual checks, follow @import with query strings, report unverified color literals; keep site copy in sync via test - publish-npm.sh fails without NPM_TOKEN; CI requires Node 22.6+; ignore outputs/
This commit is contained in:
parent
bc914eafc5
commit
97f2c241e4
19 changed files with 767 additions and 139 deletions
|
|
@ -62,6 +62,26 @@ function parseArgs(argv) {
|
|||
return out;
|
||||
}
|
||||
|
||||
// 실제 auth.json 의 복사본 경로. 정상 종료·예외·SIGINT/SIGTERM·process exit 어디서든 동기로 지운다.
|
||||
// 복사본이 남으면 outputs/ 를 git add 하거나 피평가 에이전트가 형제 폴더를 읽을 때 토큰이 새기 때문이다.
|
||||
let authToCleanup = null;
|
||||
function removeAuthCopy() {
|
||||
if (!authToCleanup) return;
|
||||
try {
|
||||
fs.unlinkSync(authToCleanup);
|
||||
} catch {
|
||||
// 이미 지워졌거나 만든 적이 없다
|
||||
}
|
||||
authToCleanup = null;
|
||||
}
|
||||
process.on("exit", removeAuthCopy);
|
||||
for (const sig of ["SIGINT", "SIGTERM"]) {
|
||||
process.on(sig, () => {
|
||||
removeAuthCopy();
|
||||
process.exit(130);
|
||||
});
|
||||
}
|
||||
|
||||
function tomlString(s) {
|
||||
return `"${String(s).replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
||||
}
|
||||
|
|
@ -191,10 +211,9 @@ async function main() {
|
|||
|
||||
const realAuthPath = path.join(realHome, ".codex", "auth.json");
|
||||
const isolatedAuthPath = path.join(isolatedCodexHome, "auth.json");
|
||||
let authCopied = false;
|
||||
if (fs.existsSync(realAuthPath)) {
|
||||
fs.copyFileSync(realAuthPath, isolatedAuthPath);
|
||||
authCopied = true;
|
||||
authToCleanup = isolatedAuthPath;
|
||||
}
|
||||
|
||||
const windowsSection = extractWindowsSectionFromRealConfig(realHome);
|
||||
|
|
@ -254,6 +273,7 @@ async function main() {
|
|||
});
|
||||
child.stdin.write(text, "utf8");
|
||||
child.stdin.end();
|
||||
let killTimer = null;
|
||||
const timer = setTimeout(() => {
|
||||
result.killedReason = "timeout";
|
||||
try {
|
||||
|
|
@ -261,9 +281,10 @@ async function main() {
|
|||
} catch {
|
||||
// 무시
|
||||
}
|
||||
setTimeout(() => {
|
||||
// child.killed 는 신호를 "보냈다"는 뜻이라 SIGTERM 직후 이미 true 다. 실제 종료 여부는 exitCode·signalCode 로 본다.
|
||||
killTimer = setTimeout(() => {
|
||||
try {
|
||||
if (!child.killed) child.kill("SIGKILL");
|
||||
if (child.exitCode === null && child.signalCode === null) child.kill("SIGKILL");
|
||||
} catch {
|
||||
// 무시
|
||||
}
|
||||
|
|
@ -304,6 +325,7 @@ async function main() {
|
|||
});
|
||||
});
|
||||
clearTimeout(timer);
|
||||
clearTimeout(killTimer);
|
||||
const changed = diffSnapshots(snapshotBefore, snapshotDir(workdir));
|
||||
if (logStream) logStream.write(JSON.stringify({ type: "eval_turn_end", filesChanged: [...changed.added, ...changed.modified] }) + "\n");
|
||||
result.turnsRun++;
|
||||
|
|
@ -319,20 +341,17 @@ async function main() {
|
|||
if (logStream) await new Promise((r) => logStream.end(r));
|
||||
result.durationMs = Date.now() - startedAt;
|
||||
|
||||
if (authCopied) {
|
||||
try {
|
||||
fs.unlinkSync(isolatedAuthPath);
|
||||
} catch {
|
||||
// 무시 — 그래도 최선을 다해 지운다
|
||||
}
|
||||
}
|
||||
removeAuthCopy();
|
||||
|
||||
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
||||
fs.writeFileSync(outPath, JSON.stringify(result, null, 2));
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error("run-codex.mjs 실패:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
main()
|
||||
.catch((err) => {
|
||||
console.error("run-codex.mjs 실패:", err);
|
||||
removeAuthCopy();
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(removeAuthCopy);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue