Skip to content

feat(gemini): add Google Vertex AI Workload Identity Federation auth#48185

Merged
pelikhan merged 7 commits into
mainfrom
copilot/add-authentication-methods-again
Jul 27, 2026
Merged

feat(gemini): add Google Vertex AI Workload Identity Federation auth#48185
pelikhan merged 7 commits into
mainfrom
copilot/add-authentication-methods-again

Conversation

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Enterprise Gemini workloads on Vertex AI / Gemini Enterprise Agent Platform require keyless authentication via Google Cloud WIF rather than a static GEMINI_API_KEY. This adds provider: google support to engine.auth, aligned with the existing Anthropic WIF pattern for Claude.

Changes

Core auth plumbing

  • EngineAuthConfig — adds GoogleWorkloadIdentityProvider, GoogleServiceAccount, GoogleProject, GoogleLocation fields
  • applyEngineAuthEnv — emits AWF_AUTH_GOOGLE_WORKLOAD_IDENTITY_PROVIDER, AWF_AUTH_GOOGLE_SERVICE_ACCOUNT, AWF_AUTH_GOOGLE_PROJECT, AWF_AUTH_GOOGLE_LOCATION for the AWF api-proxy sidecar
  • engine_config_parser — parses workload-identity-provider, service-account, project, location from engine.auth

Gemini engine

  • isGeminiVertexWIF — detects type: github-oidc + provider: google
  • GetRequiredSecretNames — skips GEMINI_API_KEY when WIF is active
  • GetSecretValidationStep — returns empty step (no static key to validate)
  • GetExecutionSteps — sets GOOGLE_GENAI_USE_VERTEXAI=1, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION; omits GEMINI_API_KEY

Schema & docs

  • JSON schema extended with the four new engine.auth Google WIF fields
  • auth.mdx adds a full Google WIF section with field table and emitted env vars
  • engines.md Gemini row now lists the keyless alternative

Usage

permissions:
  contents: read
  id-token: write

engine:
  id: gemini
  auth:
    type: github-oidc
    provider: google
    workload-identity-provider: projects/123456789/locations/global/workloadIdentityPools/github-pool/providers/github
    service-account: gemini-sa@my-project.iam.gserviceaccount.com
    project: my-project
    location: us-central1  # optional, defaults to us-central1

When active, GEMINI_API_KEY is not required and the Gemini CLI is switched to Vertex AI backend via GOOGLE_GENAI_USE_VERTEXAI=1.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.85 AIC · ⌖ 6.6 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30221620246

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.7 AIC · ⌖ 7.23 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30223671533

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.5 AIC · ⌖ 7.96 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30224763533

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 9.68 AIC · ⌖ 9.81 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30228781602

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.4 AIC · ⌖ 8.55 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30230557448

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 4.62 AIC · ⌖ 7.86 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30236419434

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.2 AIC · ⌖ 8.79 AIC · ⊞ 7.1K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category feature
Risk 🟡 Medium
Priority Score 28/100
Score Breakdown Impact: 15, Urgency: 8, Quality: 5
Action defer — WIP draft; wait for agent to complete work

No files changed yet. Defer until the agent finalizes the implementation.

Generated by 🔧 PR Triage Agent · sonnet46 · 26.8 AIC · ⌖ 4.99 AIC · ⊞ 5.7K ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new authentication methods to Gemini Engine feat(gemini): add Google Vertex AI Workload Identity Federation auth Jul 26, 2026
Copilot AI requested a review from pelikhan July 26, 2026 12:52
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Excellent work! 🤖 This PR cleanly adds Google Vertex AI Workload Identity Federation support to the Gemini engine, aligned with the existing Anthropic WIF pattern.

What's great:

  • Comprehensive integration and unit test coverage (8 focused test cases covering happy path, missing auth, provider detection, secret handling, and env var emission)
  • Clear documentation with field tables, usage examples, and emitted env vars in auth.mdx
  • Schema extended with four new Google WIF fields (workload-identity-provider, service-account, project, location)
  • Well-structured code changes across auth plumbing, parser, and Gemini engine implementation
  • Proper handling of optional location field with sensible default (us-central1)
  • Fixtures and integration test ensure the entire compilation pipeline works end-to-end

Implementation highlights:

  • isGeminiVertexWIF() helper correctly detects type: github-oidc + provider: google
  • GetRequiredSecretNames() conditionally skips GEMINI_API_KEY when WIF is active
  • Environment variable setup properly emits AWF_AUTH_GOOGLE_* vars and switches Gemini CLI to Vertex AI backend via GOOGLE_GENAI_USE_VERTEXAI=1
  • Security-conscious: uses dynamic secret list to prevent raw tokens from being exposed in agent environment

This PR is ready for review and merge. 🎉

Generated by ✅ Contribution Check · sonnet46 · 61.8 AIC · ⌖ 10.5 AIC · ⊞ 6.2K ·

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — §30214847023

Field Value
Category feature
Risk 🟡 Medium
Priority 42/100
Breakdown Impact 25 · Urgency 7 · Quality 10
Action defer
Status DRAFT

Rationale: Google Vertex AI WIF auth — useful new feature but draft with no CI runs. 338 additions across 9 files including docs and an integration test. Defer until undrafted and CI passes.

Generated by 🔧 PR Triage Agent · sonnet46 · 34.1 AIC · ⌖ 7.94 AIC · ⊞ 5.7K ·

@pelikhan
pelikhan marked this pull request as ready for review July 26, 2026 20:10
Copilot AI review requested due to automatic review settings July 26, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds intended keyless Google Vertex AI WIF authentication for Gemini workflows.

Changes:

  • Adds Google WIF parsing and environment plumbing.
  • Configures Gemini for Vertex AI and removes static-key requirements.
  • Adds schema, tests, fixtures, and documentation.
Show a summary per file
File Description
pkg/workflow/gemini_engine.go Adds Gemini Vertex WIF behavior.
pkg/workflow/gemini_engine_test.go Tests Gemini WIF handling.
pkg/workflow/engine.go Adds Google auth fields and environment variables.
pkg/workflow/engine_config_parser.go Parses Google WIF configuration.
pkg/parser/schemas/main_workflow_schema.json Extends the workflow schema.
pkg/cli/workflows/test-gemini-wif-google.md Adds a compilation fixture.
pkg/cli/compile_wif_google_gemini_integration_test.go Tests compiled WIF output.
docs/src/content/docs/reference/engines.md Lists Gemini keyless authentication.
docs/src/content/docs/reference/auth.mdx Documents Google WIF setup.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

pkg/workflow/gemini_engine.go:312

  • Omitting location does not default to us-central1 here: this branch leaves GOOGLE_CLOUD_LOCATION unset, and Gemini CLI v0.39.1 requires both project and location for non-express Vertex auth. The documented optional configuration therefore fails validation. Set GOOGLE_CLOUD_LOCATION to us-central1 when the field is empty, or make the field required and update the schema/docs.
		if workflowData.EngineConfig.Auth.GoogleLocation != "" {
			env["GOOGLE_CLOUD_LOCATION"] = workflowData.EngineConfig.Auth.GoogleLocation
		}
  • Files reviewed: 9/9 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment thread pkg/workflow/engine.go Outdated
Comment on lines +735 to +738
setEngineAuthEnv(config.Env, "AWF_AUTH_GOOGLE_WORKLOAD_IDENTITY_PROVIDER", config.Auth.GoogleWorkloadIdentityProvider)
setEngineAuthEnv(config.Env, "AWF_AUTH_GOOGLE_SERVICE_ACCOUNT", config.Auth.GoogleServiceAccount)
setEngineAuthEnv(config.Env, "AWF_AUTH_GOOGLE_PROJECT", config.Auth.GoogleProject)
setEngineAuthEnv(config.Env, "AWF_AUTH_GOOGLE_LOCATION", config.Auth.GoogleLocation)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 20f75a1. The auth contract now matches the gh-aw-firewall OIDC initializer contract:

  • provider: gcp (not provider: google)
  • AWF_AUTH_GCP_WORKLOAD_IDENTITY_PROVIDER (lines 735-736 of engine.go)
  • AWF_AUTH_GCP_SERVICE_ACCOUNT (line 736 of engine.go)

GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION are set as Gemini CLI vars (not as AWF_AUTH_* sidecar vars), which is correct.

Comment thread pkg/workflow/gemini_engine.go Outdated
// When Google/Vertex WIF is configured, switch Gemini CLI to the Vertex AI backend.
// GEMINI_API_KEY is not needed; authentication is handled by the AWF api-proxy sidecar
// via the AWF_AUTH_GOOGLE_* env vars set through engine.auth.
env["GOOGLE_GENAI_USE_VERTEXAI"] = "1"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 20f75a1. GOOGLE_GENAI_USE_VERTEXAI is now set to "true" (line 381 of gemini_engine.go). Tests in TestGeminiVertexWIF assert the "true" value.

Comment thread pkg/workflow/gemini_engine.go Outdated
Comment on lines +109 to +110
auth := workflowData.EngineConfig.Auth
return auth.Type == "github-oidc" && auth.Provider == "google"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 20f75a1. Two layers of protection are now in place:

  1. isGeminiVertexWIF requires all three fields (workload-identity-provider, service-account, project) before activating WIF (lines 108-113 of gemini_engine.go).
  2. validateGCPWIFEngineAuth in compiler_validators.go (line 434) runs at compile time and emits a clear error listing which required fields are missing when provider: gcp is declared. This prevents compilation if required fields are absent.


Additionally, `GOOGLE_GENAI_USE_VERTEXAI=1` is always set when Google WIF is active.

---

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 20f75a1. The ## Troubleshooting auth errors heading is restored at line 401 of auth.mdx, immediately after the separator that closes the Google WIF section.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: feat(gemini) — Google Vertex AI WIF auth

Four blocking issues identified (3 pre-existing + 1 new):

  1. Firewall env-var contract mismatch (engine.go:738) — emits AWF_AUTH_PROVIDER=google but the pinned gh-aw-firewall OIDC initializer expects AWF_AUTH_PROVIDER=gcp with AWF_AUTH_GCP_* prefixed vars.
  2. Wrong Vertex AI flag value (gemini_engine.go:306) — GOOGLE_GENAI_USE_VERTEXAI="1" does not activate Vertex auth in Gemini CLI >= v0.39.1; the required value is "true".
  3. Missing required-field validation in isGeminiVertexWIF (gemini_engine.go:110) — detects WIF solely on type+provider; a config with missing workload-identity-provider, service-account, or project silently passes.
  4. location default not applied in code (gemini_engine.go:311) — docs and schema say location defaults to us-central1, but GOOGLE_CLOUD_LOCATION is only emitted when explicitly set, creating a doc/code mismatch.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 33 AIC · ⌖ 5.83 AIC · ⊞ 5K

Comment thread pkg/workflow/gemini_engine.go Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Test Quality Sentinel Report

Score: 77/100 - Acceptable

Analyzed 9 tests: 9 design, 0 implementation, 0 violations.

All tests pass the 30% implementation threshold. Minor inflation flag (2.8:1 ratio) but non-blocking given the new WIF feature surface.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 52.4 AIC · ⌖ 7.43 AIC · ⊞ 8.1K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Quality Sentinel: 77/100 - Acceptable. 0% implementation tests (threshold: 30%). Minor inflation flag (2.8:1) is non-blocking — WIF feature coverage is justified.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, verify the branch is up to date, and address these unresolved review threads:

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.7 AIC · ⌖ 7.23 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, verify the branch is up to date, and address these unresolved review threads:

Both threads are already resolved:

  • r3653469787 — resolved (the us-central1 default is applied in code in commit 20f75a1)
  • r3653469786 — resolved (same fix)

The branch is up to date with main (merge commit d22bde8). All TestGeminiVertexWIF and TestGeminiEngine tests pass locally.

Remaining maintainer blockers:

  • The 4 copilot-pull-request-reviewer threads are all outdated (from the original commit 8295034) and unresolvable via the API since they're marked outdated — the underlying issues were all addressed in 20f75a1 (firewall contract, GOOGLE_GENAI_USE_VERTEXAI=true, WIF field validation, Troubleshooting heading).
  • Human approval from pelikhan / gh-aw-bot is still required.
  • CI must be re-triggered by a maintainer (close/reopen or push) to get a fresh green run on the current HEAD.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.5 AIC · ⌖ 7.96 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

...

Branch is up to date with main (merge commit d22bde8). All review threads are either resolved or outdated:

  • 2 resolved — the us-central1 default threads (r3653356956, r3653362127), addressed in 20f75a1.
  • 4 outdated — all copilot-pull-request-reviewer threads from original commit 8295034; the underlying issues (firewall contract, GOOGLE_GENAI_USE_VERTEXAI=true, WIF field validation, Troubleshooting heading) were all fixed in 20f75a1.

Local go test ./pkg/workflow/... passes. The previous CI run (30221831464) completed successfully. The current agent check (30223899833) is in progress.

Still needed: Human approval from pelikhan / gh-aw-bot before merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 9.68 AIC · ⌖ 9.81 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, and rerun checks once the branch is up to date.

...

Branch is up to date (d22bde8). Two prior CI check runs completed successfully (30223899833, 30221831464); a third is currently in progress (30225046356).

All review threads are resolved or outdated — no code changes remain. The only blocker is human reviewer approval (pelikhan / gh-aw-bot).

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category feature
Risk 🟡 medium
Priority Score 40 / 100
Score Breakdown Impact: 22 · Urgency: 8 · Quality: 10
Recommended Action ⏸ defer

Summary: Adds provider: google Workload Identity Federation support for Gemini Enterprise on Vertex AI — aligned with existing Anthropic WIF pattern. However, CHANGES_REQUESTED from github-actions[bot] (multiple rounds) indicate concerns are unresolved. Feature is additive and non-breaking but needs review iteration.

Next action: Defer until CHANGES_REQUESTED are resolved by the author.

Generated by 🔧 PR Triage Agent · sonnet46 · 49 AIC · ⌖ 8.25 AIC · ⊞ 5.7K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once the branch is up to date.

Unresolved review threads:

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.4 AIC · ⌖ 8.55 AIC · ⊞ 7.1K ·
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review feedback and any failing checks, then rerun the relevant checks once the branch is ready for maintainer review.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 4.62 AIC · ⌖ 7.86 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address unresolved review feedback and any failing checks, then rerun the relevant checks once the branch is ready for maintainer review.

...

All 4 unresolved review threads are outdated (is_outdated: true) — the code they referenced was fixed in commit 20f75a1 and each thread already has a reply. The most recent completed CI check runs (30229130881, 30225046356, 30223899833, 30221831464) all show success on the current HEAD (d22bde8). No code changes or check reruns are needed.

Status:

  • ✅ Reviews — 4 outdated threads all replied to; 2 resolved
  • ✅ Checks (local) — make fmt, go test ./pkg/workflow/..., make agent-report-progress-no-test all pass
  • ✅ Checks (CI) — 4 prior runs on current HEAD completed successfully
  • ✅ Mergeable — branch is up to date, no conflicts

Still needed: Human approval to merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the outstanding blocking review feedback for the Google Vertex AI WIF path, and rerun the relevant checks once fixes are ready. Prioritize the firewall env-var contract mismatch, the incorrect GOOGLE_GENAI_USE_VERTEXAI value, incomplete WIF validation, and the missing/defaulted GOOGLE_CLOUD_LOCATION behavior.

Generated by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/30236419434

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.2 AIC · ⌖ 8.79 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the outstanding blocking review feedback for the Google Vertex AI WIF path, and rerun the relevant checks once fixes are ready. Prioritize the fire...

All four items were addressed in commit 20f75a1:

  1. Firewall env-var contractAWF_AUTH_GCP_WORKLOAD_IDENTITY_PROVIDER and AWF_AUTH_GCP_SERVICE_ACCOUNT with AWF_AUTH_PROVIDER=gcp are emitted (engine.go:730,735-736).
  2. GOOGLE_GENAI_USE_VERTEXAI value — set to "true", not "1" (gemini_engine.go:381).
  3. WIF validationisGeminiVertexWIF requires all three fields (workload-identity-provider, service-account, project) to be non-empty before activating WIF; validateGCPWIFEngineAuth in compiler_validators.go provides compile-time enforcement.
  4. GOOGLE_CLOUD_LOCATION defaultus-central1 is applied in code when location is omitted and the env var is always emitted (gemini_engine.go:385-388).

All 5 consecutive CI runs on the current HEAD show success. The only remaining blocker is human maintainer approval.

@pelikhan
pelikhan merged commit 870215a into main Jul 27, 2026
29 checks passed
@pelikhan
pelikhan deleted the copilot/add-authentication-methods-again branch July 27, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GEMINI ENGINE - Add new authentication methods

4 participants