Skip to content

Commit 67cc63d

Browse files
committed
test: retain evaluation runs while dropping auth after cleanup failure
Main removes copied authentication even when command cleanup stays incomplete, and CI tests that merge. Keep the incomplete-cleanup diagnostics and the retained run directory, and expect auth.json to be gone.
1 parent 0cfd505 commit 67cc63d

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

‎tests/boundary/process/agentEvaluationCommands.test.ts‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readFile, writeFile } from "node:fs/promises";
1+
import { readFile, stat, writeFile } from "node:fs/promises";
22
import { join } from "node:path";
33
import { fileURLToPath } from "node:url";
44
import { expect } from "vitest";
@@ -187,16 +187,17 @@ registerHooks({ load(url, context, nextLoad) {
187187
const { run }: { run: string } = JSON.parse(
188188
await readFile(receipt, "utf8"),
189189
);
190+
// Copied authentication is removed even when the owned command stays
191+
// incomplete. The run directory stays until that command releases.
192+
await expect(readFile(join(run, "codex/auth.json"))).rejects.toMatchObject({
193+
code: "ENOENT",
194+
});
190195
if (incomplete) {
191196
expect(result.stderr).toContain("Artifact cleanup remains incomplete");
192197
expect(result.stderr).toContain("fixture cleanup denied");
193-
expect(await readFile(join(run, "codex/auth.json"), "utf8")).toBe(
194-
"inert fixture",
195-
);
198+
expect((await stat(run)).isDirectory()).toBe(true);
196199
} else {
197-
await expect(
198-
readFile(join(run, "codex/auth.json")),
199-
).rejects.toMatchObject({ code: "ENOENT" });
200+
await expect(stat(run)).rejects.toMatchObject({ code: "ENOENT" });
200201
}
201202
},
202203
);
@@ -295,16 +296,19 @@ registerHooks({ load(url, context, nextLoad) {
295296
expect(await readFile(retried, "utf8")).toBe(
296297
"exact preparation owner retried",
297298
);
299+
// Copied authentication is removed even when preparation stays incomplete.
300+
// The run directory stays until that command releases.
301+
await expect(
302+
readFile(join(observed.run, "codex/auth.json")),
303+
).rejects.toMatchObject({ code: "ENOENT" });
298304
if (incomplete) {
299305
expect(result.stderr).toContain("Artifact cleanup remains incomplete");
300306
expect(result.stderr).toContain("darwin-fixture-reader");
301-
expect(
302-
await readFile(join(observed.run, "codex/auth.json"), "utf8"),
303-
).toBe("inert preparation fixture");
307+
expect((await stat(observed.run)).isDirectory()).toBe(true);
304308
} else {
305-
await expect(
306-
readFile(join(observed.run, "codex/auth.json")),
307-
).rejects.toMatchObject({ code: "ENOENT" });
309+
await expect(stat(observed.run)).rejects.toMatchObject({
310+
code: "ENOENT",
311+
});
308312
}
309313
},
310314
);

0 commit comments

Comments
 (0)