Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/server/responses/combo-stream-preflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ function retryableZeroOutputTerminal(payload: unknown): boolean {
if (event.type === "response.failed") return true;
if (event.type !== "response.incomplete") return false;
const reason = event.response?.incomplete_details?.reason;
return typeof reason === "string" && RETRYABLE_ZERO_OUTPUT_INCOMPLETE_REASONS.has(reason);
return reason === undefined
|| (typeof reason === "string" && RETRYABLE_ZERO_OUTPUT_INCOMPLETE_REASONS.has(reason));
}

/**
Expand Down
14 changes: 14 additions & 0 deletions tests/routing/combo-stream-preflight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ describe("combo stream preflight", () => {
}
});

test("converts a zero-output incomplete without a stated reason into a retryable failure", async () => {
for (const response of [
{ id: "r1", status: "incomplete" },
{ id: "r1", status: "incomplete", incomplete_details: null },
]) {
const result = await preflightComboStreamResponse(sse(
{ type: "response.created", response: { id: "r1", status: "in_progress" } },
{ type: "response.incomplete", response },
), { model: "m1", provider: "a" });
expect(result.kind).toBe("failed");
expect(result.response.status).toBe(502);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});

test("does not replay semantic incompletes that another provider cannot safely repair", async () => {
const source = sse(
{ type: "response.created", response: { id: "r1", status: "in_progress" } },
Expand Down
Loading