test(live): skip codex html interruptions in modern sweep

This commit is contained in:
Peter Steinberger
2026-04-14 23:29:13 +01:00
parent 75e7fc97f8
commit e1e0120c0d

View File

@@ -175,6 +175,14 @@ function isInstructionsRequiredError(raw: string): boolean {
return /instructions are required/i.test(raw);
}
function isOpenAiCodexHtmlInterruption(raw: string): boolean {
const trimmed = raw.trim().replace(/^Error:\s*/i, "");
return (
/^(?:<!doctype\s+html\b|<html\b)/i.test(trimmed) &&
(/<meta\s+name=["']viewport["']/i.test(trimmed) || /<body\b/i.test(trimmed))
);
}
function isModelTimeoutError(raw: string): boolean {
return /model call timed out after \d+ms/i.test(raw);
}
@@ -277,6 +285,15 @@ describe("resolveLiveSystemPrompt", () => {
} as Model<Api>),
).toBeUndefined();
});
it("matches OpenAI Codex HTML interruption pages", () => {
expect(
isOpenAiCodexHtmlInterruption(
'Error: <html><head><meta name="viewport" content="width=device-width" /></head><body>Try again</body></html>',
),
).toBe(true);
expect(isOpenAiCodexHtmlInterruption("Error: connection reset")).toBe(false);
});
});
async function completeSimpleWithTimeout<TApi extends Api>(
@@ -764,6 +781,15 @@ describeLive("live models (profile keys)", () => {
logProgress(`${progressLabel}: skip (instructions required)`);
break;
}
if (
allowNotFoundSkip &&
model.provider === "openai-codex" &&
isOpenAiCodexHtmlInterruption(message)
) {
skipped.push({ model: id, reason: message });
logProgress(`${progressLabel}: skip (codex html interruption)`);
break;
}
if (allowNotFoundSkip && isModelTimeoutError(message)) {
skipped.push({ model: id, reason: message });
logProgress(`${progressLabel}: skip (timeout)`);