fix(providers): surface real Antigravity upstream error detail (#13591) - #13801
Merged
diegosouzapw merged 2 commits intoSep 16, 2026
Merged
diegosouzapw merged 2 commits into
diegosouzapw merged 2 commits into
Conversation
Antigravity double-wraps its own errors: buildAntigravityUpstreamError() replaced error.message with the generic "Antigravity upstream error (400)" template and buried the real Gemini-dialect detail under upstream_details. chatCore's shared failure path re-parses that already-wrapped body with the generic parseUpstreamError(), which only reads the outer error.message, so the generic text is what ends up in createErrorResult, the persisted call logs, and the [ProxyEgress] antigravity status=error lines. buildAntigravityUpstreamError() now composes error.message from the real upstream detail when present, so both the HTTP response and every log/telemetry consumer that reads error.message get the actual detail. Regression test: tests/unit/antigravityUpstreamError.test.ts
…or-swallowed (base-red fix #13747)
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…souzapw#13591) (diegosouzapw#13801) Merged in the 2026-09-16 sweep of the maintainer's own open PRs, at the owner's explicit instruction. No push was made to the PR branch: the merge took the head as the owning session left it (verified OPEN, non-draft and MERGEABLE against the release tip immediately before merging).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #13591
Not covered here: the suspected root trigger (
omr_skill_*schema rejections causing the400s in the first place) is tracked separately at #13583, already fixed by #11857 on
release/v3.8.51. This PR only fixes the observability half — surfacing the real upstreamdetail instead of the opaque wrapper text — which is how the owner explicitly scoped the
issue in their own comment.
Root cause (short)
Antigravity double-wraps its own errors.
buildAntigravityUpstreamError()(
open-sse/executors/antigravityUpstreamError.ts) replacederror.messagewith the generic"Antigravity upstream error (400)"template and buried the real Gemini-dialect detail onelevel down, under
upstream_details.chatCore.ts's shared failure-classification path(
providerFailure:block, both streaming and non-streaming legs) re-parses thatalready-wrapped body with the generic
parseUpstreamError(), which only reads the outererror.message— so the generic text is what ends up increateErrorResult().error, thepersisted
call_logs/proxy_logs, and the[ProxyEgress] antigravity status=errorline.This is why
gemini(the plain API-key/OAuth provider) shows the real field-path message andantigravitydoesn't: thegeminiexecutor never pre-wraps non-ok responses, so the rawGoogle body survives untouched to the same parser.
Fix
buildAntigravityUpstreamError()now extracts the real upstreamerror.messagefrom theparsed
upstream_details(when present) and composes the finalerror.messageas"Antigravity upstream error (<status>): <real detail>"instead of the bare templatedstring. This fixes both consumers for free — the client-facing HTTP response and every
internal log/telemetry path that reads
error.message— with no changes needed inchatCore.tsorparseUpstreamError(). The existing geo-blocked branch (its own explicit,more useful hint text) is left untouched, and a non-JSON upstream body (e.g. an HTML error
page) still falls back to the generic templated message without throwing.
Regression test
tests/unit/antigravityUpstreamError.test.ts(new file, 3 cases):RED (on unfixed code):
GREEN (after the fix):
Run command:
DATA_DIR=$(mktemp -d) timeout 300 node --import tsx/esm --test --test-force-exit tests/unit/antigravityUpstreamError.test.tsGates run
npx eslint --suppressions-location config/quality/eslint-suppressions.json open-sse/executors/antigravityUpstreamError.ts tests/unit/antigravityUpstreamError.test.ts— exit 0npm run check:open-sse-typecheck— OK, 0 pre-existing errorsnode scripts/check/check-file-size.mjs— OK on touched files (1 unrelated pre-existing violation inopen-sse/utils/stream.ts, not touched by this PR)node scripts/check/check-complexity.mjs— OK (2824 violations vs baseline 3218)node scripts/check/check-cognitive-complexity.mjs— OK (1276 violations vs baseline 1437)node scripts/check/check-test-discovery.mjs— OK, new test file discoveredtests/unit/antigravity-geoblock-resilience.test.ts(16/16 pass)tests/unit/agy-gemini-400-3229.test.ts(pass)tests/unit/antigravity-streaming-error-body-sanitized-2461.test.ts(pass)Existing tests aligned
None — no existing assertion encoded the old buggy contract; all three existing test files
above exercise shapes unaffected by this change (binary/non-JSON bodies, the geo-blocked
branch, and pass-through behavior for non-Antigravity providers) and pass unmodified.