mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
fix(backend): add error.code to synthOpenAIErrorChunk for guard compatibility (#8570)
synthOpenAIErrorChunk() sets error.type to upstream_empty_response but omits error.code. The isRequestScopedUpstreamFailure guard only checks type for context_length_exceeded, so an upstream_empty_response error slips past it. - Added code: upstream_empty_response to the error object in synthOpenAIErrorChunk() - Added test assertion verifying error.code matches error.type This ensures the guard correctly identifies upstream empty responses as request-scoped failures. Closes #8469
This commit is contained in:
committed by
GitHub
parent
82bed08404
commit
dfd4d33287
@@ -122,6 +122,7 @@ export function synthOpenAIErrorChunk(opts: {
|
||||
error: {
|
||||
message: safeMessage,
|
||||
type: "upstream_empty_response",
|
||||
code: "upstream_empty_response",
|
||||
},
|
||||
};
|
||||
return `data: ${JSON.stringify(body)}\n\n`;
|
||||
|
||||
@@ -39,6 +39,7 @@ test("synthOpenAIErrorChunk payload has expected OpenAI chunk shape", () => {
|
||||
assert.equal(payload.choices.length, 1);
|
||||
assert.ok(payload.error, "must have error field");
|
||||
assert.equal(payload.error.type, "upstream_empty_response");
|
||||
assert.equal(payload.error.code, "upstream_empty_response");
|
||||
assert.ok(typeof payload.error.message === "string" && payload.error.message.length > 0);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user