mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
fix(sse): carry the upstream error code/type through the provider pipeline
parseUpstreamError() already returns errorCode/errorType; the pipeline was dropping both on the floor. Gates that key on the pair — notably isAntigravityMissingProjectError — never fired, so a config-class 422 turned into a generic account cooldown instead of a fail-closed answer. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
This commit is contained in:
@@ -218,7 +218,20 @@ async function toOutcome(
|
||||
body,
|
||||
retryAfterMs: details.retryAfterMs,
|
||||
});
|
||||
const result = createErrorResult(restatement.status, message, restatement.retryAfterMs);
|
||||
// Carry the upstream classification through too. #12867 dropped it when it replaced
|
||||
// parseUpstreamError() with an inline JSON.parse, and the sibling leg
|
||||
// (nonStreamingProviderLeg.ts) still lifts both fields. Gates that key on the PAIR —
|
||||
// isAntigravityMissingProjectError (src/sse/handlers/chatPredicates.ts) — could never
|
||||
// fire without them, so a config-class 422 degraded into a generic account cooldown.
|
||||
// These stay internal: the client-visible body is still projected onto the bounded
|
||||
// identifier vocabulary by buildErrorBody() (Hard Rule #12).
|
||||
const result = createErrorResult(
|
||||
restatement.status,
|
||||
message,
|
||||
restatement.retryAfterMs,
|
||||
typeof details.errorCode === "string" ? details.errorCode : undefined,
|
||||
typeof details.errorType === "string" ? details.errorType : undefined
|
||||
);
|
||||
return {
|
||||
kind: "error",
|
||||
result: {
|
||||
|
||||
Reference in New Issue
Block a user