fix: normalize "bedrock" provider ID to "amazon-bedrock"

Add "bedrock" and "aws-bedrock" as aliases for the canonical
"amazon-bedrock" provider ID in normalizeProviderId().

Without this mapping, configuring a model as "bedrock/..." causes
the auth resolution fallback to miss the Bedrock-specific AWS SDK
path, since the fallback check requires normalized === "amazon-bedrock".
This primarily affects the main agent when the explicit auth override
is not preserved through config merging.

Fixes #15716
This commit is contained in:
Fred White
2026-02-24 00:03:00 -05:00
committed by Peter Steinberger
parent b3e6653503
commit b7deb062ea
3 changed files with 18 additions and 0 deletions

View File

@@ -77,6 +77,18 @@ describe("resolveModelAuthMode", () => {
),
).toBe("aws-sdk");
});
it("returns aws-sdk for bedrock alias without explicit auth override", () => {
expect(resolveModelAuthMode("bedrock", undefined, { version: 1, profiles: {} })).toBe(
"aws-sdk",
);
});
it("returns aws-sdk for aws-bedrock alias without explicit auth override", () => {
expect(resolveModelAuthMode("aws-bedrock", undefined, { version: 1, profiles: {} })).toBe(
"aws-sdk",
);
});
});
describe("requireApiKey", () => {

View File

@@ -19,6 +19,9 @@ describe("model-selection", () => {
expect(normalizeProviderId("OpenCode-Zen")).toBe("opencode");
expect(normalizeProviderId("qwen")).toBe("qwen-portal");
expect(normalizeProviderId("kimi-code")).toBe("kimi-coding");
expect(normalizeProviderId("bedrock")).toBe("amazon-bedrock");
expect(normalizeProviderId("aws-bedrock")).toBe("amazon-bedrock");
expect(normalizeProviderId("amazon-bedrock")).toBe("amazon-bedrock");
});
});

View File

@@ -50,6 +50,9 @@ export function normalizeProviderId(provider: string): string {
if (normalized === "kimi-code") {
return "kimi-coding";
}
if (normalized === "bedrock" || normalized === "aws-bedrock") {
return "amazon-bedrock";
}
// Backward compatibility for older provider naming.
if (normalized === "bytedance" || normalized === "doubao") {
return "volcengine";