Skip to content

Conversation

@kcwhite
Copy link
Contributor

@kcwhite kcwhite commented May 25, 2025

Related GitHub Issue

Closes: #3492

Description

This PR adds support for custom VPC endpoints when using AWS Bedrock models. This feature is particularly important for corporate customers who need to keep all LLM transactions secure inside their firewall.

Implementation details:

  • Added a new configuration option in the Bedrock provider settings to specify a custom endpoint URL
  • Updated the AWS Bedrock client initialization to use the custom endpoint when provided
  • Maintained backward compatibility for users who don't specify a custom endpoint
  • Added appropriate validation for the endpoint URL format

Test Procedure

  1. Unit Tests: Added tests for the Bedrock provider with custom endpoints

    • Tests verify that the client is properly configured with the custom endpoint
    • Tests confirm backward compatibility when no endpoint is specified
  2. Manual Testing:

    • Configure Roo Code with AWS Bedrock provider
    • Add a custom VPC endpoint URL in the settings
    • Verify that requests are routed through the specified endpoint
    • Verify that error handling works correctly for invalid endpoints
    • Verify text box disappears when "Use custom VPC endpoint" checkbox is unchecked
    • Verify that requests fail when "Use custom VPC endpoint" option is disabled and other settings are unchanged
    • Verify that the previous custom VPC endpoint URL populates the text box when re-enabling the option
    • Verify that requests succeed after re-enabling the option
  3. Verification:

    • All tests pass as confirmed by running pnpm test
    • The feature has been tested with actual AWS VPC endpoints in a corporate environment

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Code Quality:
    • My code adheres to the project's style guidelines.
    • There are no new linting errors or warnings (npm run lint).
    • All debug code (e.g., console.log) has been removed.
  • Testing:
    • New and/or updated tests have been added to cover my changes.
    • All tests pass locally (npm test).
    • The application builds successfully with my changes.
  • Branch Hygiene: My branch is up-to-date (rebased) with the main branch.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Changeset: A changeset has been created using npm run changeset if this PR includes user-facing changes or dependency updates.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

I have included 2 screenshots

Documentation Updates

  • Yes, documentation updates are required. The AWS Bedrock provider documentation should be updated to include information about the new custom VPC endpoint option, including format requirements and use cases.

Additional Notes

This feature has been requested by several enterprise customers who need to use Roo Code with their secure AWS environments. It enables them to comply with their internal security policies while still leveraging the power of AWS Bedrock models through Roo Code.

Get in Touch

Discord: chuck_33620

670103AE-C745-4A5D-9930-8DEA5294D00E
6AECC094-75B8-49D0-89FA-780E35E91909


Important

Adds support for custom VPC endpoints in AWS Bedrock models with UI and backend changes, ensuring backward compatibility and comprehensive test coverage.

  • Behavior:
    • Adds support for custom VPC endpoints in AWS Bedrock models via awsBedrockEndpoint and awsBedrockEndpointEnabled in ProviderSettings.
    • Updates AwsBedrockHandler in bedrock.ts to use custom endpoint if enabled.
    • Maintains backward compatibility if no custom endpoint is specified.
  • UI:
    • Adds checkbox and text field for VPC endpoint configuration in Bedrock.tsx.
    • Updates UI state based on awsBedrockEndpointEnabled.
  • Tests:
    • Adds unit tests in bedrock-vpc-endpoint.test.ts to validate endpoint configuration logic.
    • Adds UI tests in Bedrock.test.tsx to verify checkbox and text field behavior.
  • Types:
    • Updates ProviderSettings in roo-code.d.ts and types.ts to include new fields for VPC endpoint configuration.

This description was created by Ellipsis for 617e68e. You can customize this summary. It will automatically update as commits are pushed.

Kevin White and others added 23 commits May 11, 2025 03:11
- Changed checkbox label to 'Use custom VPC endpoint' to match Cline

- Fixed conditional rendering to show text field when checkbox is checked

- Ensured placeholder text appears correctly

- Maintained proper styling for consistency
- Added state variable to track checkbox selection

- Fixed conditional rendering to show/hide text field based on checkbox state

- Maintained proper styling and placeholder text
…ling

- Fixed checkbox onChange handler to accept boolean directly instead of event object

- Added unit tests to verify the behavior

- Maintained proper styling and placeholder text
- Removed left margin from text field to align with checkbox

- Maintained proper styling and placeholder text
- Added awsBedrockEndpointEnabled field to schema

- Modified Bedrock provider to check both endpoint URL and enabled flag

- Updated UI to preserve endpoint URL when checkbox is toggled

- Maintained proper alignment with checkbox
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap May 31, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap May 31, 2025
@daniel-lxs
Copy link
Member

LGTM!

Thank you!

setAwsEndpointSelected(isChecked)
setApiConfigurationField("awsBedrockEndpointEnabled", isChecked)
}}>
Use custom VPC endpoint
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you internationalize this string please?

style={{ width: "100%", marginTop: 3, marginBottom: 5 }}
type="url"
onInput={handleInputChange("awsBedrockEndpoint")}
placeholder="Enter VPC Endpoint URL (optional)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This too

data-testid="vpc-endpoint-input"
/>
<div className="text-sm text-vscode-descriptionForeground ml-6 mt-1 mb-3">
Examples:
Copy link
Collaborator

Choose a reason for hiding this comment

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

And this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this

Sorry Matt, bit of a noob contributor. Are you asking me or Daniel to internationalize the strings?

Copy link
Member

@daniel-lxs daniel-lxs May 31, 2025

Choose a reason for hiding this comment

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

@kcwhite I can handle this if you want, sorry for not noticing the missing translations, I'll be more careful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thx

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kcwhite I can handle this if you want, sorry for not noticing the missing translations, I'll be more careful

No problem, I'll see if I can configure Ellipsis to try to catch this as well.

@kcwhite
Copy link
Contributor Author

kcwhite commented May 31, 2025 via email

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap May 31, 2025
@kcwhite kcwhite requested review from daniel-lxs and mrubens May 31, 2025 01:35
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 31, 2025
@mrubens mrubens merged commit a4c91c6 into RooCodeInc:main May 31, 2025
11 checks passed
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap May 31, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap May 31, 2025
SmartManoj pushed a commit to SmartManoj/Raa-Code that referenced this pull request Jun 13, 2025
…webview-ui (RooCodeInc#3947)

* Fix linter warnings in the webview (part 2)

Replace protobus calls using object literals to use Message.create({...})

Fix incorrect property name detected after this change in webview-ui/src/components/settings/SettingsView.tsx

Optimised imports in vscode.

* formatting

* feat(lint): Add custom ESLint rules for protobuf type checking

Add two custom ESLint rules to enforce proper usage patterns when creating protobuf objects.

Using .create() to build protobufs ensures that the protobuf is type checked when it is created. Protobufs created using
object literals are not type checked,  which can lead to subtle bugs and type mismatches. The linter rules detect when protobufs are created without using .create() or .fromPartial().

- no-protobuf-object-literals: Enforces the use of `.create()` or `.fromPartial()` methods instead of object literals when creating protobuf types.

```
/Users/sjf/cline/src/shared/proto-conversions/state/chat-settings-conversion.ts
   9:9  warning  Use ChatSettings.create() or ChatSettings.fromPartial() instead of object literal for protobuf type
Found: return {
             mode: chatSettings.mode === "plan" ? PlanActMode.PLAN : PlanActMode.ACT,
             preferredLanguage: chatSettings.preferredLanguage,
             openAiReasoningEffort: chatSettings.openAIReasoningEffort,
     }
  Suggestion: ChatSettings.create({
             mode: chatSettings.mode === "plan" ? PlanActMode.PLAN : PlanActMode.ACT,
             preferredLanguage: chatSettings.preferredLanguage,
             openAiReasoningEffort: chatSettings.openAIReasoningEffort,
     })
```

- no-grpc-client-object-literals: Enforces proper protobuf creation for gRPC service client parameters. This needs a separate rule
because the type signatures of the ServiceClients methods are too generic to be detected by the previous rule.

```
/Users/sjf/cline/webview-ui/src/components/mcp/configuration/tabs/add-server/AddRemoteServerForm.tsx
   41:62  warning  Use the appropriate protobuf .create() or .fromPartial() method instead of object literal for gRPC client parameters.
Found: McpServiceClient.addRemoteMcpServer({
                             serverName: serverName.trim(),
                             serverUrl: serverUrl.trim(),
                     })
```

These rules help maintain code quality by enforcing consistent patterns for working with protocol buffers throughout the codebase, reducing potential runtime errors from improper message construction.

* Update test

* Add custom eslint rules to new webview-ui config

* Only include webview grpc ServiceClient check

* Fix lint errors

* formatting

* Update package.json

* Make the no-grpc-client-object-literals linter rule an error for the webview-ui

Fix the last occurrence of this issue.

* formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer PR - Changes Requested size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add AWS Bedrock Custom VPC Endpoint Support

4 participants