Skip to content

fix(vertex): show gcloud ADC credentials as verified once a token is minted - #8720

Closed
andrew05060414 wants to merge 5 commits into
lidge-jun:devfrom
andrew05060414:fix/vertex-adc-verified
Closed

andrew05060414 wants to merge 5 commits into
lidge-jun:devfrom
andrew05060414:fix/vertex-adc-verified

Conversation

@andrew05060414

@andrew05060414 andrew05060414 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Problem. A Google Vertex provider that authenticates with gcloud Application Default Credentials (gcloud auth application-default login, or a gcp-sa: marker) showed "Credentials unverified" / "Saved — proxy credentials unverified" forever, even when requests worked. The dashboard decided the state from the config shape alone, and the connection test returned static_catalog before touching credentials, so nothing could ever clear it.

After this PR. Once the proxy has minted an access token from the ADC source it would use now, the provider shows as Ready. "Test connection" on a static-catalog Vertex row now mints that token instead of skipping, so one click verifies a gcloud login. A refused exchange, or a changed ADC file or marker, puts the row back to unverified.

Details.

  • src/lib/gcp-adc.ts records the source and generation of the last successful token exchange per scope (vertexAdcCredentialVerified). No network call; the proof lapses when the observed source changes and is cleared by a failed exchange.
  • safeConfigDTO exposes a boolean vertexCredentialVerified for ambient and marker rows (never any credential material).
  • New src/server/management/static-catalog-probe.ts: the static-catalog branch of POST /api/providers/test verifies Vertex ADC; every other static catalog (for example Antigravity) still returns static_catalog without credential resolution. It is a new file so provider-routes.ts does not grow.
  • GUI: a verified row is neither "unverified" nor "needs setup"; a passing connection test clears the warning immediately.
  • Docs (en, ko, zh-cn adapters reference) describe what the connection test now proves: the credential, not Vertex IAM permissions.

Verification

Vertex status

Screenshot: local Vite dev server with mocked API responses (fake data). One Vertex row has vertexCredentialVerified: true (Ready), the other does not (Credentials unverified).

  • bun test tests/adapters/google/vertex-adc-verified.test.ts tests/adapters/google/gcp-adc.test.ts tests/gui/provider-workspace-data.test.ts tests/adapters/google/vertex-model-discovery.test.ts: all pass. The new test covers: unverified then verified after a mint, a verified row bins as ready, replacing the ADC file drops the proof, a refused exchange is not verified, the static-catalog test verifies ADC and reports a failed exchange, and it still skips Antigravity and API-key rows.
  • One existing assertion in gcp-adc.test.ts expected the old skip; it now expects ok: true, and that test pins GOOGLE_APPLICATION_CREDENTIALS to its fixture instead of reading the host gcloud directory.
  • bun run typecheck, bun run lint:gui (oxlint), bun run privacy:scan, bun run structure:check, tests/test-layout.test.ts: pass.
  • Full bun run test was not run locally. On this Windows host the preload git-config guard and test-layout-tooling fail for every file because git rejects GIT_CONFIG_GLOBAL=NUL ("unable to access 'NUL'"); focused runs used OCX_GIT_CONFIG_GUARD_CHECKOUT pointed at a directory without .git. Coverage beyond the files above is left to CI.

Refreshed on dev 450abd0 (2026-11-13)

Merged the current dev head 450abd02c (merge commit, no history rewrite).

  • bun run typecheck, bun run structure:check, bun run skill:surface:check and bun run privacy:scan: exit 0.
  • Fixed a temporal-dead-zone error in gui/src/components/provider-workspace/ProviderOverview.tsx: vertexUnverified now reads the connection test result, so its declaration had moved below the probe state while effectiveStatus still read it earlier. cd gui && npx tsc -b failed with TS2448/TS2454, and rendering a provider overview would have thrown a ReferenceError. The status computation now sits after the flag.
  • cd gui && npx tsc -b and bun run lint: exit 0. The 21 GUI suites that render ProviderOverview or the provider workspace: 318 pass, 0 fail.
  • Guards plus this PR's tests (OCX_GIT_CONFIG_GUARD_CHECKOUT pointed at a directory without .git): 230 tests, 224 pass, 6 fail.
  • The 6 failures are the same cases that fail on an untouched dev checkout on this Windows host (test-layout-tooling move end to end ×4 and two structure-ssot git-index cases): their temp repositories run git with GIT_CONFIG_GLOBAL=NUL, which git 2.56 for Windows rejects with fatal: unable to access 'NUL'. None of them touches a file in this PR.
  • Full-suite exception: the full bun run test and bun run test:changed were not run (same host limitation and several worktrees sharing the machine); full coverage is left to CI.
  • Still needs the maintainer-sponsored label: the hygiene gate flags src/server/auth-cors.ts. Everything else is ready for review.

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. The DTO adds one boolean; the connection test mints a token only for Vertex ADC rows, the same exchange the first request performs, and never returns it.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

A Google Vertex provider on Application Default Credentials (gcloud login or a
gcp-sa: marker) showed "Credentials unverified" forever. The dashboard decided
it from the config shape alone, and the connection test returned
static_catalog before touching credentials, so nothing could ever clear it.

- gcp-adc records the credential source of the last successful token exchange;
  the config DTO exposes vertexCredentialVerified for ambient/marker rows. The
  proof lapses when the ADC file or marker changes, and a refused exchange
  clears it.
- The static-catalog connection test now mints a Vertex ADC token instead of
  skipping, so the button verifies the login. Other static catalogs still skip.
- The overview treats a passing connection test as verified immediately.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/server/auth-cors.ts.

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

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • hygiene: unsponsored_surface.

What to do

  • Fix unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/server/auth-cors.ts.

Review readiness checklist

  • ✅ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

Hygiene

⚠️ Deterministic hygiene checks failed.

  • unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/server/auth-cors.ts.

…lag it reads

vertexUnverified now depends on the connection test result, so its declaration moved below the probe state; effectiveStatus still read it above, a temporal-dead-zone ReferenceError on render and a tsc -b error.
@andrew05060414

Copy link
Copy Markdown
Contributor Author

Superseded by #8740, which carries this change together with the related accounts and credentials PRs as one commit each on current dev, with no stacking. The design notes in this description still apply.

lidge-jun added a commit that referenced this pull request Nov 16, 2026
…ed Vertex ADC (carries #8740, #8750) (#8778)

* fix(antigravity): scope round-robin and session affinity per quota family

Round-robin peeked a model-filtered ring but committed on the unfiltered
account list, so the realign path reseeded the ring and the next request got
the same account. Both sides now read the same model- and exhaustion-filtered
list, and the ring key carries the quota family (genericPoolKey(provider,
family)), so a Gemini request no longer moves the Claude ring.

Conversation affinity keeps one binding per family with the family-less key
as a read fallback. Accounts with known zero headroom for the requested family
are dropped unless every listing account is spent, including on the
model-listing reroute. A manual selection seeds the provider ring and both
family rings.

Source: #8740 (fef2c75, b9dd5db), originally #8664.

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

* fix(antigravity): rotate to a sibling account when one account's 403 is refused

A pooled google-antigravity account whose credential Google refused answered
every request with 403 PERMISSION_DENIED, and the pool kept sending to it: only
the VALIDATION_REQUIRED shape rotated. A plain access-denied 403 now cools the
refused credential generation for 60 seconds (the existing auth cooldown, no
needs-reauth mark) and replays on the next live sibling, repeating while
siblings remain up to the failover limit. A 403 whose PERMISSION_DENIED body is
worded as invalid credentials normalizes to "authentication failed" and is
treated the same way.

The verify-account shape keeps its durable quarantine path on both the main
dispatch and the web-search sidecar. The sidecar accepts the same plain refusal
for its one rotation, so the web-search validation cases that used to assert
"never rotates" for unrelated, spoofed and malformed 403 bodies now assert one
sibling rotation with nothing persisted; verify-account wording and oversized
bodies still never rotate.

Source: #8750 (7441a44).

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

* fix(antigravity): replay a 502/503/504 once on a sibling and share one cooldown write

The transient ladder retried a failing Antigravity account only against itself,
so one account stuck on 503/504 kept answering every request that landed on it.
After the ladder gives up before any output, the request now replays once on a
live sibling and the failed account is cooled for 15 seconds (process-local, no
stored verdict). One hop per request keeps a pool-wide outage to two ladders.

The 403 refusal and the 5xx fault now take one rotation path: both pick the
sibling through nextAntigravitySibling and dispatch through rotateAntigravityAuth,
which checks the failover limit before any cooldown is written. Both cooldowns
go through coolAntigravityAccount, fenced on the sent credential generation and
never shortening a cooldown already running for the account and family, so a
15-second fault window cannot cut short a 60-second refusal.

docs-site (English and Spanish, which carried the old wording) now describes the
403 walk and the 5xx hop.

Source: #8750 (bdf1139).

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

* feat(vertex): show gcloud ADC credentials as verified once a token is minted

A Google Vertex provider signed in with Application Default Credentials kept
showing "Credentials unverified" because nothing recorded a successful token
exchange. src/lib/gcp-adc.ts now records the source and generation of the last
successful exchange per credential scope; the proof lapses when the ADC source
the next request would use changes, and a failed exchange clears only its own
record, never a newer exchange's. safeConfigDTO exposes one boolean,
vertexCredentialVerified, for ambient and marker rows (no credential material).

The static-catalog branch of POST /api/providers/test mints one Vertex ADC token
(new src/server/management/static-catalog-probe.ts); every other static catalog,
including Antigravity and API-key Vertex, still answers static_catalog before
any credential resolution. The dashboard treats a verified row as ready, keeps
its "Host credentials" auth label, and drops a retained probe result when the
verification state changes. Docs say the test proves the credential, not
Vertex permissions.

Source: #8740 (947ed8a, ef78868, 801e772, and the probe-key line of
9e0a92b), originally #8720.

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

* fix(antigravity): rotate only on Google's structured PERMISSION_DENIED 403

classifyGoogle writes the bare "Antigravity access denied" prefix for every 403,
including an empty body, a proxy or WAF HTML page and an envelope without the
status enum. hasAntigravityAccessDeniedMarker accepted that prefix, so any 403
walked the pool and wrote a 60 second family cooldown on every account.

The marker now requires the "(PERMISSION_DENIED)" suffix classifyGoogle keeps
only when it parsed the enum, or the authentication-failed prefix, and still
requires classifyAntigravityRefusal(403, text) to be "other". Text carrying the
validation marker never qualifies. Unrelated, spoofed and malformed web-search
403 bodies and the oversized or spoofed-prefix main-path variants keep their
refusal again; a structured PERMISSION_DENIED earns the one sibling rotation, and
an empty, HTML or enum-less 403 is not rotated and cools nothing. Docs and the
responses-failover note say what triggers the walk.

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

* fix(vertex): require an access_token before verifying ADC and skip reference rows in the probe

resolveAccessToken recorded "verified" for any 200 token response; a body
without a non-empty access_token now fails the exchange before the token cache
and the verified record are written.

The static-catalog connection test resolved keychain: and ${ENV} reference rows
through selectVertexDiscoveryCredential before answering static_catalog. It now
classifies the configured text with vertexConfiguredCredentialKind, the rule the
dashboard DTO already used, and answers for api-key and reference rows without
reading the credential store. The Spanish adapters page no longer claims the
static-catalog test verifies nothing, and the structure note describes the probe.

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

* refactor(pool): drop the unused prefix sweep in clearPoolRotationState

No production caller clears a generic provider key, and the one codex caller
already clears its scoped keys explicitly, so the prefix sweep never ran for the
Antigravity family rings and only widened what clearing the codex key removes.
reconcilePoolRotationState alone treats generic:<provider>:<family> keys as part
of their provider; the structure note says so, and now records that Antigravity
session affinity writes two entries per session.

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>

---------

Co-authored-by: Andrew (agent) <wsy1731095638@gmail.com>
lidge-jun pushed a commit to andrew05060414/opencodex that referenced this pull request Nov 19, 2026
lidge-jun pushed a commit to andrew05060414/opencodex that referenced this pull request Nov 19, 2026
lidge-jun pushed a commit to andrew05060414/opencodex that referenced this pull request Nov 19, 2026
lidge-jun pushed a commit to andrew05060414/opencodex that referenced this pull request Nov 19, 2026
lidge-jun added a commit that referenced this pull request Nov 19, 2026
…family rotation, verified Vertex ADC (#8740)

* feat(accounts): read-only per-account Antigravity probe and manual model discovery

Original PR: #8642

* fix(antigravity): scope round-robin and session affinity per quota family

Original PR: #8664

* feat(gui): per-account quota table on the Providers accounts tab

Original PR: #8721

* fix(vertex): show gcloud ADC credentials as verified once a token is minted

Original PR: #8720

* fix(gui): tighten the account quota table, probe line and discovery panel

Drop the table's Actions column (it duplicated the card buttons and overflowed),
show one cell for a row with no reading and a dash for a pool an account lacks,
label remaining as "% left" beside cards that show "% used", keep Test all in
the header action group, show card plans by product name, omit evidence for a
usable probe, and hide model discovery while live discovery is off.

* fix(gui): a verified Vertex ADC row keeps the host-credentials auth label

Once vertexCredentialVerified was true the row fell through to "API key".

* fix(cli): models discover exits nonzero when the server reports a failed discovery

* fix(quota): an Antigravity probe re-reads the roster so a pause made mid-run suppresses its request

* fix(models): discovery refresh reports GET's arrival state and fetches even when catalog convergence gathers nothing

* fix(vertex): a failed older ADC exchange no longer erases a newer exchange's verification

* fix(oauth): Antigravity model-listing reroutes skip a sibling whose quota family is exhausted

* fix(gui): a late initial read no longer replaces refreshed arrivals, and a Vertex verification change resets the probe

* fix(gui): the account table marks a next account only under reset-first

* docs(structure): account plan badges show mapped names; the next marker needs reset-first

* feat(gui): make the account quota table the one OAuth account list

The Accounts tab showed every account twice: the compact quota table on top
and the older per-account cards below it. The table now carries each card's
controls (pause/resume, reauthenticate, test, alias, remove, reset grants and
coupons) in an actions column, and a detail line under a row keeps the hints,
probe result, Anthropic per-account threshold and any quota window no pool
column shows. The card list is removed for generic OAuth providers.

Below a 900px container width the rows stack (account, plan and status, then
one line per pool, then the controls) so no button needs sideways scrolling;
above it the actions column stays pinned to the right edge.

* feat(gui): show an upstream-banned account as one red row in the account list

An account auto-paused with reason account_permission_denied now reads
"Banned upstream" in the status column, and its quota cells are replaced by
one notice (automatic refresh stopped) with a "View reason" disclosure that
shows the redacted upstream message, pause time and HTTP status when the
server recorded them. Resume stays the manual way back. needsReauthReason
verify_account reads "Verification needed" instead of the generic sign-in
flag. pauseDetails gains the optional message and statusCode fields.

* fix(gui): stack account rows below 1100px so the pinned actions never cover the status

At a 980px container the English table is wider than its box, and the
right-pinned actions column sat on top of the status column. The provider
workspace caps content at about 960px, so the stacked layout is now the one
the dashboard shows; the table layout stays for wider containers.

* fix(accounts): keep the last good model list on Discover now; show the ban notice without quota readings; treat an expired token as routine

* test(accounts): cover banned rows, verification flag, probe controls, and expired-token flag

* Test account probe transport and management boundaries

* Harden stored-account probes and finish dashboard and CLI parity

* Document discovery within the catalog reference budget

* Give the OAuth quota table room for desktop columns

* Require a live observation for manual model discovery

* Scope manual discovery and keep Antigravity account probes read-only

Respect model discovery cooldown, join concurrent requests, and keep
manual discovery and arrival processing scoped to the requested provider.
Bound pinned error bodies for per-account probes and resolve CLI targets
through a passive store read. Preserve stale quota diagnostics and render
unknown tier IDs as text.

* Keep full provider policy context for scoped model discovery

Scope the captured provider fetches while retaining the configuration
that decides alias ownership and catalog projection.

* Share scoped and full catalog provider discovery

Join in-flight discovery at the provider boundary under the same resolved
credential and policy. Fence model cache publication so delayed results
cannot replace a newer roster, while preserving discovery backoff.

Derive and publish combo omissions only during full gathers.

* Fence shared catalog discovery by credential and outcome

* Resolve provider workspace React Doctor findings

* Preserve caller-local Copilot rows after supersession

* Fence model discovery at admission and catalog publication

* Cover superseded discovery on model listing routes

* Project superseded discovery for model listing reads

* Keep superseded Claude listings from replacing Desktop aliases

* Preserve complete Desktop snapshots when discovery is superseded

Keep the last complete snapshot while its aliases still resolve to the
same routes. Report a retryable 503 when no usable snapshot exists so
connected apply keeps the previous static profile. Keep the existing
Anthropic listing projection and exercise the production apply path.

* Document Desktop snapshot retries in the Spanish API reference

Keep the English and Spanish response identifiers in sync with the
Desktop snapshot retry contract.

* Bind Desktop snapshot retries to listing policy

* fix(desktop): retry superseded model snapshots

* test(gui): update OAuth account quota table assertions

* Extract Anthropic model listing from server serve options

* fix(gui): show pause evidence in banned quota rows

---------

Co-authored-by: JUN <jun@lidgeai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working intake: hygiene-blocked Deterministic PR hygiene checks failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant