test: assert cron model diagnostics

This commit is contained in:
Shakker
2026-05-11 12:44:13 +01:00
parent 775a24e57c
commit 69c2bc58fa
@@ -175,15 +175,17 @@ describe("runCronIsolatedAgentTurn — cron model override (#21057)", () => {
expect(result.status).toBe("error");
expect(result.error).toContain("Model not allowed");
expect(result.diagnostics).toMatchObject({
summary: expect.stringContaining("Model not allowed"),
entries: [
expect.objectContaining({
source: "cron-preflight",
severity: "error",
message: expect.stringContaining("Model not allowed"),
}),
],
expect(result.diagnostics?.summary).toBe(
"cron payload.model 'anthropic/claude-sonnet-4-6' rejected: Model not allowed: anthropic/claude-sonnet-4-6",
);
expect(result.diagnostics?.entries).toHaveLength(1);
expect(result.diagnostics?.entries[0]?.ts).toBeTypeOf("number");
expect(result.diagnostics?.entries[0]).toEqual({
ts: result.diagnostics?.entries[0]?.ts,
source: "cron-preflight",
severity: "error",
message:
"cron payload.model 'anthropic/claude-sonnet-4-6' rejected: Model not allowed: anthropic/claude-sonnet-4-6",
});
// Model should remain undefined — the early return happens before the
// pre-run persist block, so neither the session entry nor the store
@@ -240,7 +242,7 @@ describe("runCronIsolatedAgentTurn — cron model override (#21057)", () => {
// The run should still complete successfully despite the persist failure
expect(result.status).toBe("ok");
expect(logWarnMock).toHaveBeenCalledWith(
expect.stringContaining("Failed to persist pre-run session entry"),
"[cron:digest-job] Failed to persist pre-run session entry: Error: ENOSPC: no space left on device",
);
});