Support custom transports for Amazon Bedrock (#33695)

## What changed

- Allow the built-in `amazon-bedrock` provider to override `base_url`, `auth`,
  and `http_headers` in addition to its AWS profile and region.
- Use command-based bearer authentication and configured endpoints without
  applying AWS request signing, while retaining regional endpoint resolution
  for the default Bedrock configuration.
- Replace the Bedrock account `credentialSource` enum with the
  `usesCodexManagedCredentials` boolean so command-authenticated and other
  externally managed configurations are reported consistently.

## Testing

- Cover configuration merging and validation, command-authenticated proxy
  requests with custom headers, and account reporting for managed and external
  credentials.

GitOrigin-RevId: d1acbe602060470583b5e12f8d304bee5be46f4c
This commit is contained in:
Celia Chen authored and copyberry committed 2026-07-16 21:41:00 +00:00
1 parent 18110b810f
commit 315195492c
20 files changed
+362 -148

No files matched your search

@@ -1755,7 +1755,6 @@ mod tests {
use super::*;
use anyhow::Result;
use codex_protocol::ThreadId;
use codex_protocol::account::AmazonBedrockCredentialSource;
use codex_protocol::account::PlanType;
use codex_protocol::config_types::MultiAgentMode;
use codex_protocol::models::BUILT_IN_PERMISSION_PROFILE_READ_ONLY;
@@ -2995,35 +2994,35 @@ mod tests {
);
let codex_managed_bedrock = v2::Account::AmazonBedrock {
credential_source: AmazonBedrockCredentialSource::CodexManaged,
uses_codex_managed_credentials: true,
};
assert_eq!(
json!({
"type": "amazonBedrock",
"credentialSource": "codexManaged",
"usesCodexManagedCredentials": true,
}),
serde_json::to_value(&codex_managed_bedrock)?,
);
let aws_managed_bedrock = v2::Account::AmazonBedrock {
credential_source: AmazonBedrockCredentialSource::AwsManaged,
let externally_managed_bedrock = v2::Account::AmazonBedrock {
uses_codex_managed_credentials: false,
};
assert_eq!(
json!({
"type": "amazonBedrock",
"credentialSource": "awsManaged",
"usesCodexManagedCredentials": false,
}),
serde_json::to_value(&aws_managed_bedrock)?,
serde_json::to_value(&externally_managed_bedrock)?,
);
Ok(())
}
#[test]
fn account_defaults_legacy_bedrock_credential_source() -> Result<()> {
fn account_defaults_legacy_bedrock_managed_credentials_flag() -> Result<()> {
assert_eq!(
v2::Account::AmazonBedrock {
credential_source: AmazonBedrockCredentialSource::AwsManaged,
uses_codex_managed_credentials: false,
},
serde_json::from_value(json!({
"type": "amazonBedrock",