From be40cadd018cececc27fb208365b9d7f9fa0b2b8 Mon Sep 17 00:00:00 2001 From: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Date: Fri, 11 Sep 2026 12:55:42 -0300 Subject: [PATCH] fix(sse): carry the upstream error code/type through the provider pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- .../chatCore/providerExecutionPipeline.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/open-sse/handlers/chatCore/providerExecutionPipeline.ts b/open-sse/handlers/chatCore/providerExecutionPipeline.ts index bce99f10d8..aa76df7c20 100644 --- a/open-sse/handlers/chatCore/providerExecutionPipeline.ts +++ b/open-sse/handlers/chatCore/providerExecutionPipeline.ts @@ -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: {