fix(google): preserve upstream error precedence for location denials (carry of #3547) - #3608
Conversation
…ot an invalid request Google Cloud Code Assist (Antigravity) and Vertex reject unsupported geographic or datacenter locations with HTTP 400 FAILED_PRECONDITION "User location is not supported for the API use." classifyGoogle folded every 400 into "invalid request", and the shared classifier then emitted invalid_request_error — telling the user their prompt was malformed when the network location was refused. - classifyGoogle: new "location not supported" branch after auth/quota/permission enums and before the generic 400 fallthrough, so UNAUTHENTICATED / RESOURCE_EXHAUSTED / PERMISSION_DENIED keep precedence. - classifyError: location denials map to permission_error / location_not_supported, placed after the authoritative 401 block. - inferHttpStatusFromAdapterMessage: message-only terminals infer 403 so they agree with the classified envelope instead of falling through to 502. - Direct HTTP responses keep the upstream 400. Carries PR #3469 with the precedence fix and without the VPN/TUN console warning. Closes #3467 Co-authored-by: agentHits <zvercombat26rus@icloud.com>
Restrict Google location inference to 400 precondition envelopes and preserve 5xx and explicit PERMISSION_DENIED classification. Add regression assertions without running local tests. Co-authored-by: agentHits <zvercombat26rus@icloud.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe change adds detection and classification for unsupported Google geographic or datacenter locations. It preserves direct HTTP 400 responses, infers HTTP 403 for message-only paths, keeps higher-priority errors authoritative, and prevents retries. ChangesGoogle location denial handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Google location denials are now reported as location-not-supported permission errors without changing authoritative HTTP statuses or retry behavior. No concrete current-head merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant GoogleAPI
participant GoogleAdapter
participant ErrorClassifier
participant ProxyResponse
GoogleAPI->>GoogleAdapter: HTTP 400 FAILED_PRECONDITION with location text
GoogleAdapter->>ErrorClassifier: classify location denial
ErrorClassifier-->>GoogleAdapter: location_not_supported
GoogleAdapter-->>ProxyResponse: preserve HTTP 400
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d47274769
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| // Location denials outrank generic permission / subscription wording, but never an | ||
| // authoritative 5xx. Message-only adapter terminals arrive here with inferred 403. | ||
| if (status < 500 && (type === "location_not_supported" || isLocationUnsupportedMessage(text))) { |
There was a problem hiding this comment.
Preserve explicit Google enums through final classification
When Vertex or Antigravity returns PERMISSION_DENIED or INVALID_ARGUMENT with location wording, safeGoogleHttpErrorMessage correctly normalizes it to access denied or invalid request, but the enum itself is then discarded. The Responses path subsequently calls classifyError, where this condition matches the retained detail before the generic permission/invalid-request branches, changing both cases to location_not_supported. Thus the precedence asserted by the new Google tests is not preserved in the client-facing envelope; carry the classified reason/code through normalization or recognize the authoritative normalized prefix before applying location inference.
AGENTS.md reference: src/AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
리뷰 · 우선순위 74 / 80이 PR은 Google Antigravity / Vertex / Gemini 쪽에서 올라오는 “User location is not supported for the API use.” 거절을, 지금 지금 이 방향은 열린 선행 PR 테스트는
라인 없음 - PR 본문에 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
✅ Deterministic PR hygiene checks passed. |
Owner-authorized admin squash of child-only #3551 carry onto corrected #3608. Scheme-matched proxy snapshot, explicit proxy transport binding, exact IPv6 prefix and NO_PROXY denial retained. Existing source security assessment and current static/typecheck evidence recorded. No local tests; final dev Linux CI is the batch gate.
Summary
Carries #3547 / #3469 and fixes the concrete error-precedence blocker. Google location inference is restricted to the observed 400/precondition envelope; 5xx remains a server failure and explicit PERMISSION_DENIED retains its permission classification. Message-only terminals retain bounded location inference.
Verification
Checklist
Co-authored-by: agentHits zvercombat26rus@icloud.com
Summary by CodeRabbit
Bug Fixes
location_not_supportedcode instead of generic invalid-request errors.Documentation