feat(claude): handle Vertex AI configuration in preWorkspaceStart - #2276
Conversation
|
Warning Review limit reached
More reviews will be available in 58 minutes and 21 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds Vertex AI environment injection to Claude workspace startup and removes Vertex AI-specific workspace configuration from agent secret setup. Related tests were updated to match the new behavior. ChangesVertex AI workspace updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@extensions/claude/src/claude-extension.ts`:
- Around line 124-146: The Claude Vertex env var sync in claude-extension.ts
only adds/upserts values in the vertexai branch, but it never removes stale
CLAUDE_CODE_USE_VERTEX, CLOUD_ML_REGION, or ANTHROPIC_VERTEX_PROJECT_ID when
Vertex mode is no longer valid. Update the logic around the
context.model.llmMetadata?.name check so the workspace.environment is cleaned up
whenever the model is not vertexai or
GOOGLE_VERTEX_PROJECT/GOOGLE_VERTEX_LOCATION are missing, and keep the existing
upsert behavior when valid values are present.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: eed79867-4acc-4d14-8b1c-0259c9355cdf
📒 Files selected for processing (4)
extensions/claude/src/claude-extension.spec.tsextensions/claude/src/claude-extension.tspackages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.tspackages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
💤 Files with no reviewable changes (2)
- packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
- packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
- GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
- GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
- GitHub Check: unit tests / windows-2022
- GitHub Check: unit tests / macos-15
- GitHub Check: Linux
- GitHub Check: unit tests / ubuntu-24.04
- GitHub Check: typecheck
- GitHub Check: Windows
- GitHub Check: linter, formatters
- GitHub Check: macOS
⚠️ CI failures not shown inline (4)
GitHub Actions: fullsend / dispatch _ Route: feat(claude): handle Vertex AI configuration in preWorkspaceStart
Conclusion: failure
##[group]Run set -euo pipefail
�[36;1mset -euo pipefail�[0m
�[36;1mif [[ -f .fullsend/config.yaml ]]; then�[0m
�[36;1m KILL_SWITCH=$(yq '.kill_switch // false' .fullsend/config.yaml)�[0m
�[36;1m if [[ "$KILL_SWITCH" == "true" ]]; then�[0m
�[36;1m echo "::error::Kill switch is active — all agent dispatch halted"�[0m
GitHub Actions: fullsend / 6_dispatch _ Route.txt: feat(claude): handle Vertex AI configuration in preWorkspaceStart
Conclusion: failure
##[group]Run set -euo pipefail
�[36;1mset -euo pipefail�[0m
�[36;1m�[0m
�[36;1mif [[ ! "$STAGE" =~ ^[a-z][a-z0-9_-]*$ ]]; then�[0m
�[36;1m echo "::error::Invalid stage name: must start with lowercase letter and contain only [a-z0-9_-]"�[0m
GitHub Actions: fullsend / dispatch _ Route: feat(claude): handle Vertex AI configuration in preWorkspaceStart
Conclusion: failure
##[group]Run set -euo pipefail
�[36;1mset -euo pipefail�[0m
�[36;1mEVENT_PAYLOAD=$(jq -c '{�[0m
�[36;1m issue: (.issue // null | if . then {number, html_url} else null end),�[0m
�[36;1m pull_request: (.pull_request // null | if . then {number, html_url,�[0m
�[36;1m head: {ref: .head.ref, sha: .head.sha, repo: {full_name: .head.repo.full_name}},�[0m
�[36;1m base: {ref: .base.ref, repo: {full_name: .base.repo.full_name}}} else null end),�[0m
�[36;1m comment: (.comment // null | if . then {body: .body[:4096]} else null end)�[0m
�[36;1m}' "$GITHUB_EVENT_PATH") || {�[0m
�[36;1m echo "::error::Failed to extract event payload from GITHUB_EVENT_PATH"�[0m
GitHub Actions: fullsend / dispatch _ Route: feat(claude): handle Vertex AI configuration in preWorkspaceStart
Conclusion: failure
##[group]Run set -euo pipefail
�[36;1mset -euo pipefail�[0m
�[36;1m�[0m
�[36;1mif [[ ! "$STAGE" =~ ^[a-z][a-z0-9_-]*$ ]]; then�[0m
�[36;1m echo "::error::Invalid stage name: must start with lowercase letter and contain only [a-z0-9_-]"�[0m
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
/@/path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory
Files:
extensions/claude/src/claude-extension.tsextensions/claude/src/claude-extension.spec.ts
extensions/*/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Register inference, container, and Kubernetes providers through the
ProviderRegistryvia extension APIs
Files:
extensions/claude/src/claude-extension.tsextensions/claude/src/claude-extension.spec.ts
**/*.spec.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.spec.{ts,tsx,js,jsx}: Usetest()instead ofit()for test cases in Vitest unit tests
Usevi.mock(import('...'))for auto-mocking modules in unit tests; avoid manual mock factories when possible
Usevi.resetAllMocks()inbeforeEachhooks instead ofvi.clearAllMocks()for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, usevi.mocked(...)with the prototype pattern for class methods:vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)
Files:
extensions/claude/src/claude-extension.spec.ts
🧠 Learnings (4)
📚 Learning: 2026-05-05T17:30:20.418Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:20.418Z
Learning: In the openkaiden/kaiden repo, for cloud inference provider extension code under `extensions/*/src/*.ts`, treat `ProviderConnectionStatus = 'unknown'` as a valid/expected value when registering provider connections (e.g., Gemini/Claude/Mistral/OpenAI-compatible/Vertex AI). `'unknown'` indicates the connection was set up but is not continuously monitored—so do not flag it as incorrect. Only Ollama is expected to use `'started'` because it actively polls a local server.
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/claude-extension.spec.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/claude-extension.spec.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/claude-extension.spec.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/claude-extension.spec.ts
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Update Claude extension to handle Vertex AI-specific workspace configuration when a Vertex AI model is selected. The extension now reads Google environment variables (GOOGLE_VERTEX_PROJECT, GOOGLE_VERTEX_LOCATION) provided by the core and adds Claude Code-specific environment variables needed for Vertex AI. Changes: - Add Vertex AI detection in preWorkspaceStart method - Set CLAUDE_CODE_USE_VERTEX=1 when using Vertex AI models - Map GOOGLE_VERTEX_LOCATION to CLOUD_ML_REGION - Map GOOGLE_VERTEX_PROJECT to ANTHROPIC_VERTEX_PROJECT_ID - Add comprehensive tests for Vertex AI environment variable handling Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Jeff MAURY <jmaury@redhat.com> Fixes openkaiden#2247
2457d12 to
b803307
Compare
|
@coderabbitai resolve |
✅ Action performedComments resolved and changes approved. |
…enkaiden#2276) Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Summary
Update Claude extension to handle Vertex AI-specific workspace configuration when a Vertex AI model is selected. This moves Vertex AI configuration logic from the core (agent-workspace-manager) into the Claude extension's
preWorkspaceStartmethod.Changes
preWorkspaceStartmethodCLAUDE_CODE_USE_VERTEX=1when using Vertex AI modelsGOOGLE_VERTEX_LOCATIONtoCLOUD_ML_REGIONGOOGLE_VERTEX_PROJECTtoANTHROPIC_VERTEX_PROJECT_IDapplyVertexAiConfigurationworkaround from coreHow It Works
ensureModelSecretprocesses the Vertex AI connection and addsGOOGLE_VERTEX_PROJECTandGOOGLE_VERTEX_LOCATIONto the workspace environmentpreWorkspaceStartdetects the Vertex AI model type, reads those Google env vars, and adds the Claude-specific env varsTest Plan
🤖 Generated with Claude Code
Fixes #2247