fix: stabilize live probes and docs
This commit is contained in:
@@ -48,6 +48,16 @@ function isGoogleModelNotFoundError(err: unknown): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isModelNotFoundErrorMessage(raw: string): boolean {
|
||||
const msg = raw.trim();
|
||||
if (!msg) return false;
|
||||
if (/\b404\b/.test(msg) && /not[_-]?found/i.test(msg)) return true;
|
||||
if (/not_found_error/i.test(msg)) return true;
|
||||
if (/model:\s*[a-z0-9._-]+/i.test(msg) && /not[_-]?found/i.test(msg))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
describeLive("live models (profile keys)", () => {
|
||||
it(
|
||||
"completes across configured models",
|
||||
@@ -187,6 +197,15 @@ describeLive("live models (profile keys)", () => {
|
||||
},
|
||||
);
|
||||
|
||||
if (res.stopReason === "error") {
|
||||
const msg = res.errorMessage ?? "";
|
||||
if (ALL_MODELS && isModelNotFoundErrorMessage(msg)) {
|
||||
skipped.push({ model: id, reason: msg });
|
||||
continue;
|
||||
}
|
||||
throw new Error(msg || "model returned error with no message");
|
||||
}
|
||||
|
||||
const text = res.content
|
||||
.filter((block) => block.type === "text")
|
||||
.map((block) => block.text.trim())
|
||||
|
||||
@@ -52,7 +52,7 @@ function installFailingFetchCapture() {
|
||||
}
|
||||
|
||||
describe("openai-responses reasoning replay", () => {
|
||||
it("handles tool-call-only turns without requiring reasoning replay", async () => {
|
||||
it("replays reasoning for tool-call-only turns (required by OpenAI)", async () => {
|
||||
const cap = installFailingFetchCapture();
|
||||
try {
|
||||
const model = buildModel();
|
||||
@@ -141,11 +141,11 @@ describe("openai-responses reasoning replay", () => {
|
||||
)
|
||||
.filter((t): t is string => typeof t === "string");
|
||||
|
||||
expect(types).toContain("reasoning");
|
||||
expect(types).toContain("function_call");
|
||||
const reasoningIndex = types.indexOf("reasoning");
|
||||
if (reasoningIndex !== -1) {
|
||||
expect(reasoningIndex).toBeLessThan(types.indexOf("function_call"));
|
||||
}
|
||||
expect(types.indexOf("reasoning")).toBeLessThan(
|
||||
types.indexOf("function_call"),
|
||||
);
|
||||
} finally {
|
||||
cap.restore();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user