Skip to content

fix(antigravity): rotate an auth-failed 403 only under Google's PERMISSION_DENIED enum - #8835

Merged
lidge-jun merged 1 commit into
devfrom
fix/antigravity-auth-failed-enum
Nov 16, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/antigravity-auth-failed-enum

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Addresses CodeRabbit review threads PRRT_kwDOS-0Gi863wzS1 and PRRT_kwDOS-0Gi863wcE5 on #8778.

An Antigravity 403 without Google's structured error.status: "PERMISSION_DENIED" could still walk the account pool and cool each account for 60 seconds. This happened when its text said "expired", "unauthenticated" or "invalid authentication". classifyGoogle normalized such a body to the bare Antigravity authentication failed prefix, and hasAntigravityAccessDeniedMarker accepted that prefix. A proxy page saying "Session expired", or {"error":{"message":"Token expired"}}, therefore rotated through every account. That broke the module's own contract and the documented promise that a 403 Google did not mark PERMISSION_DENIED keeps its error and cools nothing.

  • src/adapters/google-errors.ts: the auth-failed prefix now keeps (PERMISSION_DENIED) (new GOOGLE_PERMISSION_DENIED_SUFFIX) only when the parsed envelope carried that enum, mirroring the existing access-denied branch. Downstream substring matching on "authentication failed" is unchanged.
  • src/server/responses/antigravity-validation-refusal.ts: the marker accepts the auth-failed alternative only with that suffix. The structured PERMISSION_DENIED auth-failed case still rotates and cools; the raw web-search sidecar path goes through the same normalizer and gets the same rule.
  • structure/transports/responses-failover.md: the shared sibling-attempt guard (antigravityAuthRotationAttempted) admits only the 401 hop and the VALIDATION_REQUIRED 403 hop. Access denial repeats up to the failover limit, and the 5xx hop has its own single-hop guard. The doc said "the 401 and 403 paths share one guard", which contradicted the access-denied pool-walk test.
  • en/es provider docs: state that "session/token expired" wording without the enum does not rotate.

Verification

Regression tests (focused, single file under /usr/bin/lockf -k /tmp/ocx-test.lock):

  • tests/server/server-google-antigravity-oauth-401-replay.test.ts: new enum-less "Token expired" envelope and "Session expired" HTML cases must not rotate or cool. On origin/dev 3ef14ad: 65 pass / 2 fail (both new cases). With the fix: 67 pass / 0 fail. A new structured PERMISSION_DENIED "Token expired" case still rotates and cools (passes before and after).
  • tests/adapters/google/google-vertex-http.test.ts: the marker and the raw sidecar predicate reject the enum-less normalized text. On origin/dev: 57 pass / 1 fail. With the fix: 58 pass / 0 fail.
  • Also green with the fix: google-errors, server-antigravity-web-search-validation, server-antigravity-verify-replay-scope, server-antigravity-model-denial-recovery, server-google-antigravity-oauth-429-budget, error-fidelity, acl-error-classification, web-search-recovery-kind, docs-429-failover-claims, docs-developer-role-policy, structure-ssot.
  • bun run typecheck, bun run structure:check, bun run privacy:scan: pass.

NOT RUN: full bun run test and test:changed locally. The host is under heavy load and this lane is limited to focused single-file runs. Broader coverage is left to CI (ci:full).

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Bug Fixes

    • Account failover now occurs only for complete Google 403 responses explicitly marked PERMISSION_DENIED. Other 403 errors—including those mentioning expired sessions or tokens—retain their original error and do not cool down an account.
    • Improved handling of qualifying access-denied responses so requests can retry with a sibling account.
  • Documentation

    • Clarified which Google 403 responses trigger account failover and which retain the original error.

…SSION_DENIED enum

classifyGoogle wrote the bare 'Antigravity authentication failed' prefix for any
403 whose text said expired/unauthenticated, and hasAntigravityAccessDeniedMarker
accepted that prefix, so an enum-less 403 (a proxy page saying 'Session expired',
or {error:{message:'Token expired'}}) walked the pool and cooled every account.
The auth-failed prefix now carries the (PERMISSION_DENIED) suffix only when the
enum was parsed, and the marker requires it.

Also correct the structure doc: the shared sibling-attempt guard admits the 401
hop and the validation 403 only.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 16, 2026 13:29
@lidge-jun lidge-jun added the ci:full Run the four full Ubuntu test shards on this pull request label Nov 16, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T13:31:27.387911Z 9ba603f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Antigravity refusal classification now requires structured Google PERMISSION_DENIED evidence for access-denied recovery. Tests cover unclassified 403 responses and structured refusals, while documentation describes the distinction and sibling-hop guards.

Changes: Antigravity 403 refusal classification

Layer / File(s) Summary
Normalize and classify structured refusals
src/adapters/google-errors.ts, src/server/responses/antigravity-validation-refusal.ts, tests/adapters/google/google-vertex-http.test.ts
Google errors with a PERMISSION_DENIED status receive a shared suffix. The refusal marker check requires that suffix. Adapter tests cover HTML proxy errors and error envelopes without the status enum.
Verify failover behavior and document guards
tests/server/server-google-antigravity-oauth-401-replay.test.ts, docs-site/src/content/docs/reference/configuration/providers.md, docs-site/src/content/docs/es/reference/configuration/providers.md, structure/transports/responses-failover.md
Replay tests cover unclassified 403 responses without cooldown or rotation, and structured access-denied responses with cooldown and sibling replay. The documentation describes the status requirement and sibling-hop guards.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Possibly related PRs

  • lidge-jun/opencodex#8778: Adds Antigravity sibling failover for qualifying 403 and 502/503/504 responses. This PR narrows the 403 classification used by that failover.
Merge Risk: Minimal · up to 9ba60

Antigravity 403 responses without Google's structured PERMISSION_DENIED status no longer rotate accounts or trigger cooldowns, and structured responses keep their failover behavior. Tests and docs are updated, and no merge-blocking risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: an auth-failed 403 rotates accounts only when Google's structured error status is PERMISSION_DENIED. The raw summary and objectives both describe this enum-gated rule …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: an auth-failed 403 rotates accounts only when Google's structured error status is PERMISSION_DENIED. The raw summary and objectives both describe this enum-gated rule in the Antigravity 403 handling, so the title matches the changeset. It also follows the conventional fix(scope) form and stays under one sentence, though it is long at 86 characters.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3ef14ad and 9ba603f.

Files selected for processing: 7

  • docs-site/src/content/docs/es/reference/configuration/providers.md
  • docs-site/src/content/docs/reference/configuration/providers.md
  • src/adapters/google-errors.ts
  • src/server/responses/antigravity-validation-refusal.ts
  • structure/transports/responses-failover.md
  • tests/adapters/google/google-vertex-http.test.ts
  • tests/server/server-google-antigravity-oauth-401-replay.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 16, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration of #8835 at 9ba603f. It fixes CodeRabbit threads PRRT_kwDOS-0Gi863wzS1 and PRRT_kwDOS-0Gi863wcE5, left on the merged #8778.

  • What it fixes: classifyGoogle adds (PERMISSION_DENIED) to the "authentication failed" wording only when it parsed Google's structured enum. hasAntigravityAccessDeniedMarker requires that suffix on both wordings. An enum-less 403 that says "Token expired" or "Session expired" therefore no longer walks the pool or cools any account. The structured PERMISSION_DENIED case still rotates, and no src/ consumer compares this text exactly. The structure doc now limits the shared sibling guard to 401 and the validation 403.
  • Regression tests: they fail on dev and pass here (server 65/2 → 67/0, unit 57/1 → 58/0).
  • Review gate: Codex completed on this exact head with no unresolved findings, CodeRabbit reviewed this head, and no review thread is open. CI on this exact head: green, including enforce-target. assert-mergeable-review: OK. Simulated merge onto the dev of this moment: clean, and no file over its size cap. Dev state: batch lane=all 43890997984 (147b59f) failed only windows 11/14 (active-turn-disconnect timeout cascade). The same product code passed that shard and case in 43874258334 (3ef14ad to 147b59f changes only test(claude-cli): hold the reader until the pre-fix child exits so the frame is always cut #8840's test files), so it is an intermittent hosted-Windows failure, recorded on Windows hosted CI quarantine for 2.98.0 (overflow matrix, client-link-stop, CLI plan) #8262.

@lidge-jun
lidge-jun merged commit c840e6d into dev Nov 16, 2026
62 of 67 checks passed
@lidge-jun
lidge-jun deleted the fix/antigravity-auth-failed-enum branch November 16, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:full Run the four full Ubuntu test shards on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant