Skip to content

fix(vertex): verified state follows the selected credential; probe forces a fresh exchange - #8836

Merged
lidge-jun merged 1 commit into
devfrom
fix/vertex-verified-selection
Nov 16, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/vertex-verified-selection

Conversation

@lidge-jun

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

Copy link
Copy Markdown
Owner

Summary

Fixes four review findings left on the merged #8778 and #8786. All of them concern Vertex credential status or a credential path.

  • Dashboard Ready for a credential inference does not use (PRRT_kwDOS-0Gi863wcEv). safeConfigDTO set vertexCredentialVerified on ambient and marker rows from the ADC proof alone. With GOOGLE_CLOUD_API_KEY set, selectVertexDiscoveryCredential picks that key for a keyless row, yet the row could still show Ready from an ADC token. The field is now set only when the row's selection is ADC, using that selection's marker scope. When the row uses the ambient API key, the field is absent and the row is not Ready.
  • Connection test passed on a cached token (PRRT_kwDOS-0Gi863wcEy). The static-catalog probe went through getVertexAccessTokenWithAuthority, which returns the cached token. A revoked refresh credential therefore kept testing ok for up to about 59 minutes. A new forceExchange option skips the completed-token cache; only the probe passes it, through resolveVertexDiscoveryAuth. A forced probe still joins an exchange already in flight and refreshes the cache on success. A refused exchange clears the proof, while inference and discovery keep using the cache.
  • Refused-exchange test could not fail (PRRT_kwDOS-0Gi863wcE6). The case called __resetVertexTokenCache() before the refused exchange, which had already cleared the proof. It now mints a 120 s token, moves the clock past expiry minus the 60 s refresh skew, checks that the proof still stands, and then refuses the refresh without a reset.
  • Hard-lock refusal-read stub ignored the bearer (PRRT_kwDOS-0Gi863x1up, test only). The wham() stub now records init.headers.authorization. Owned reads assert the stored-main bearer, including when the request carries an unrelated bearer. The caller-owned read asserts the caller's own bearer, which is a distinct placeholder token for the same account. All tokens are synthetic unsigned placeholders.

structure/providers/google.md and the en and es reference/adapters.md now describe the ADC-only verified state and the probe's fresh exchange.

Verification

Each focused file was run under /usr/bin/lockf -k /tmp/ocx-test.lock because this host is under heavy load.

Check Result
bun test tests/adapters/google/vertex-adc-verified.test.ts on this branch 17 pass, 0 fail
Same file with src/ reverted to origin/dev (3ef14ad572) 14 pass, 3 fail: both ambient-key cases (vertexCredentialVerified is true) and the forced-probe case (second probe returns ok)
Mutation: drop verifiedSources.delete(scope) in gcp-adc.ts the rewritten refused-refresh case fails, so it now guards the proof clearing
bun test tests/codex-integration/main-account-hard-lock-refusal-read.test.ts 16 pass, 0 fail (test-only change, so it passes on dev source as well)
tests/adapters/google/vertex-model-discovery.test.ts 17 pass
tests/adapters/google/gcp-adc.test.ts 57 pass
tests/adapters/google/gcp-sa-adapter.test.ts 6 pass
tests/lab/core-lab-boundary.test.ts (auth-cors.ts now imports the discovery selector) 25 pass
bun run typecheck no type errors
bun run structure:check passed
bun run privacy:scan passed

The full suite (bun run test) and bun run test:changed were not run locally. The host is under heavy load and the brief limited this lane to focused single-file runs. Wider coverage is left to CI with ci:full. No new test files were added, so the test-layout registration is unchanged. Every touched file is far below the 2,000-line cap, and none appears in file-size-baseline.json.

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
    • Vertex AI connection tests now obtain a fresh access token each time. Verification status reflects whether the provider is currently using ADC; configurations using an API key are not shown as ADC-verified.
    • ADC verification is cleared when a token refresh fails, while ordinary token requests can continue to use a valid cached token.
  • Documentation
    • Updated English and Spanish Vertex AI guidance to explain token refresh and verification status.

…probe forces a fresh exchange

The dashboard marked an ambient Vertex row verified from an ADC token even
when GOOGLE_CLOUD_API_KEY was set, so the row the adapter sends with an API
key could read Ready. vertexCredentialVerified is now set only when the
row's discovery selection is ADC, in that selection's marker scope.

The static-catalog connection test reused the cached access token, so a
revoked refresh credential kept testing ok for up to an hour. The probe now
passes forceExchange, which skips the completed-token cache; inference and
discovery keep it.

Tests: the refused-exchange case no longer resets the cache before the
refusal (which had already cleared the proof); it lets a short-lived token
expire and refuses the refresh. The hard-lock refusal-read stub records the
bearer it receives and asserts the stored-main bearer for the owned probe
and the caller's own bearer for a caller-owned read.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 16, 2026 13:30
@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:32:26.407786Z 18e3255 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

Vertex ADC probes now force fresh token exchanges, and credential verification follows the credential selected for discovery. Related tests and documentation are updated. Integration tests also assert which bearer token refusal reads send.

Changes: Vertex ADC

Layer / File(s) Summary
Force fresh ADC exchanges for connection probes
src/lib/gcp-adc.ts, src/providers/google-vertex-model-discovery.ts, src/server/management/static-catalog-probe.ts, tests/adapters/google/vertex-adc-verified.test.ts, structure/providers/google.md
The token resolver can bypass completed-token cache reuse while still joining an in-flight exchange. Static-catalog probes enable this option. Tests check repeated exchanges and cached-token behavior.
Match verification to the selected credential
src/server/auth-cors.ts, tests/adapters/google/vertex-adc-verified.test.ts, docs-site/src/content/docs/reference/adapters.md
The config DTO reports ADC verification only when discovery selects ADC. Tests cover ambient API-key selection and verification after a refused refresh. The documentation describes token refresh and verification behavior.

Refusal Read Bearer Tests

Layer / File(s) Summary
Assert bearer selection for refusal reads
tests/codex-integration/main-account-hard-lock-refusal-read.test.ts
The test fixture creates distinct bearer tokens, and the WHAM stub records Authorization headers. Tests assert the bearer used for owned and caller-owned refusal reads.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • lidge-jun/opencodex#8778: Introduced the Vertex ADC verification field and token-minting connection test that this PR updates.
  • lidge-jun/opencodex#8583: Defines Vertex discovery credential selection and scope, which this PR uses for verification.
Merge Risk: Minimal · up to 18e32

Vertex connection tests now fetch a fresh ADC token, and the verified badge appears only when ADC is the selected credential. No merge-blocking risk was 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 two behavior changes in the changeset: verified state now follows the selected Vertex credential (ADC only), and the static-catalog connection probe forces a fresh token exchange v…
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 two behavior changes in the changeset: verified state now follows the selected Vertex credential (ADC only), and the static-catalog connection probe forces a fresh token exchange via the new forceExchange option in src/lib/gcp-adc.ts. The title is specific and matches the PR objectives. It is 90 characters, which is slightly long, but it stays readable and in scope. The title also uses a 'fix(vertex):' prefix, which is a conventional-commit style that matches the bug-fix nature of the change.

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 18e3255.

Files selected for processing: 9

  • docs-site/src/content/docs/es/reference/adapters.md
  • docs-site/src/content/docs/reference/adapters.md
  • src/lib/gcp-adc.ts
  • src/providers/google-vertex-model-discovery.ts
  • src/server/auth-cors.ts
  • src/server/management/static-catalog-probe.ts
  • structure/providers/google.md
  • tests/adapters/google/vertex-adc-verified.test.ts
  • tests/codex-integration/main-account-hard-lock-refusal-read.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 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 #8836 at 18e3255. It fixes CodeRabbit threads PRRT_kwDOS-0Gi863wcEv, wcEy and wcE6 left on #8778, and x1up left on #8786.

  • Dashboard status: vertexCredentialVerified is set only when selectVertexDiscoveryCredential picks ADC, and it is read from that selection's marker. A row that sends GOOGLE_CLOUD_API_KEY no longer shows Ready on an ADC proof. The lookup runs only for ambient and marker rows, so it never reads a keychain entry or an environment reference.
  • Connection test: it uses forceExchange, so a revoked credential fails at once. Normal requests still use the cache and still join an exchange already in flight.
  • Tests: the refused-exchange test now lets the token expire instead of resetting it, so it can fail. The hard-lock test asserts which bearer each read sends.
  • Results: the Vertex test file fails 3 cases on dev and passes 17/17 here.
  • 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 be48433 into dev Nov 16, 2026
38 of 41 checks passed
@lidge-jun
lidge-jun deleted the fix/vertex-verified-selection branch November 16, 2026 15:25
andrew05060414 added a commit to andrew05060414/opencodex that referenced this pull request Nov 17, 2026
Vertex ADC verification and per-family Antigravity rotation landed on dev
(lidge-jun#8778, lidge-jun#8836); this merge takes dev's version of those files, drops the
pool-kernel prefix sweep, and keeps only the account probe, Discover now and
the account quota table. The quota table keeps dev's shared-login note.
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