Skip to content

Commit b07c7f6

Browse files
committed
fix(amazon-bedrock): expose Opus 4.7 thinking profile
1 parent b7dd912 commit b07c7f6

3 files changed

Lines changed: 57 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Docs: https://docs.openclaw.ai
3232
### Fixes
3333

3434
- Channels/Feishu: retry file-typed iOS video resource downloads as `media` after a Feishu/Lark HTTP 502 and preserve the original 502 when the fallback also fails. Fixes #49855; carries forward #50164 and #73986. Thanks @alex-xuweilong.
35+
- Providers/Amazon Bedrock: expose the full Claude Opus 4.7 thinking profile (`xhigh`, `adaptive`, and `max`) for Bedrock model refs, while keeping Opus/Sonnet 4.6 on adaptive-by-default, so `/think` menus and validation match the Anthropic transport behavior. Fixes #74701. Thanks @prasad-yashdeep, @sparkleHazard, @Sanjays2402, and @hclsys.
3536
- Plugins/tokenjuice: compile the bundled plugin against tokenjuice 0.7.0's published OpenClaw host types instead of a local compatibility shim, so package contract drift fails in OpenClaw validation before release. Thanks @vincentkoc.
3637
- OAuth/secrets: ignore root-level Google OAuth `client_secret_*.json` downloads so local client-secret files do not appear as commit candidates. (#74689) Thanks @jeongdulee.
3738
- Memory: mirror `sqlite-vec` into packaged bundled-plugin runtime deps for the default memory plugin, so builtin vector search does not lose its SQLite extension after upgrading to 2026.4.27. Fixes #74692. Thanks @mozi1924.

extensions/amazon-bedrock/index.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,36 @@ describe("amazon-bedrock provider plugin", () => {
253253
});
254254
});
255255

256+
it("mirrors Claude Opus 4.7 thinking levels for Bedrock model refs", async () => {
257+
const provider = await registerSingleProviderPlugin(amazonBedrockPlugin);
258+
259+
for (const modelId of [
260+
"us.anthropic.claude-opus-4-7",
261+
"us.anthropic.claude-opus-4.7-v1:0",
262+
"eu.anthropic.claude-opus-4-7",
263+
"arn:aws:bedrock:us-west-2:123456789012:inference-profile/us.anthropic.claude-opus-4-7",
264+
]) {
265+
expect(
266+
provider.resolveThinkingProfile?.({
267+
provider: "amazon-bedrock",
268+
modelId,
269+
} as never),
270+
).toMatchObject({
271+
levels: [
272+
{ id: "off" },
273+
{ id: "minimal" },
274+
{ id: "low" },
275+
{ id: "medium" },
276+
{ id: "high" },
277+
{ id: "xhigh" },
278+
{ id: "adaptive" },
279+
{ id: "max" },
280+
],
281+
defaultLevel: "off",
282+
});
283+
}
284+
});
285+
256286
it("owns Anthropic-style replay policy for Claude Bedrock models", async () => {
257287
const provider = await registerSingleProviderPlugin(amazonBedrockPlugin);
258288

extensions/amazon-bedrock/register.sync.runtime.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StreamFn } from "@mariozechner/pi-agent-core";
22
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
33
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
4-
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
4+
import type { OpenClawPluginApi, ProviderThinkingProfile } from "openclaw/plugin-sdk/plugin-entry";
55
import {
66
ANTHROPIC_BY_MODEL_REPLAY_HOOKS,
77
normalizeProviderId,
@@ -290,6 +290,13 @@ export function registerAmazonBedrockPlugin(api: OpenClawPluginApi): void {
290290
// initialization during test bootstrap cannot trip TDZ reads.
291291
const providerId = "amazon-bedrock";
292292
const claude46ModelRe = /claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
293+
const baseClaudeThinkingLevels = [
294+
{ id: "off" },
295+
{ id: "minimal" },
296+
{ id: "low" },
297+
{ id: "medium" },
298+
{ id: "high" },
299+
] as const satisfies ProviderThinkingProfile["levels"];
293300
// Match region from bedrock-runtime (Converse API) URLs.
294301
// e.g. https://bedrock-runtime.us-east-1.amazonaws.com
295302
const bedrockRegionRe = /bedrock-runtime\.([a-z0-9-]+)\.amazonaws\./;
@@ -303,6 +310,23 @@ export function registerAmazonBedrockPlugin(api: OpenClawPluginApi): void {
303310
const anthropicByModelReplayHooks = ANTHROPIC_BY_MODEL_REPLAY_HOOKS;
304311
const startupPluginConfig = (api.pluginConfig ?? {}) as AmazonBedrockPluginConfig;
305312

313+
function resolveBedrockClaudeThinkingProfile(modelId: string): ProviderThinkingProfile {
314+
const trimmed = modelId.trim();
315+
if (isOpus47BedrockModelRef(trimmed)) {
316+
return {
317+
levels: [...baseClaudeThinkingLevels, { id: "xhigh" }, { id: "adaptive" }, { id: "max" }],
318+
defaultLevel: "off",
319+
};
320+
}
321+
if (claude46ModelRe.test(trimmed)) {
322+
return {
323+
levels: [...baseClaudeThinkingLevels, { id: "adaptive" }],
324+
defaultLevel: "adaptive",
325+
};
326+
}
327+
return { levels: baseClaudeThinkingLevels };
328+
}
329+
306330
function resolveCurrentPluginConfig(
307331
config: OpenClawConfig | undefined,
308332
): AmazonBedrockPluginConfig | undefined {
@@ -521,16 +545,6 @@ export function registerAmazonBedrockPlugin(api: OpenClawPluginApi): void {
521545
}
522546
return undefined;
523547
},
524-
resolveThinkingProfile: ({ modelId }) => ({
525-
levels: [
526-
{ id: "off" },
527-
{ id: "minimal" },
528-
{ id: "low" },
529-
{ id: "medium" },
530-
{ id: "high" },
531-
...(claude46ModelRe.test(modelId.trim()) ? [{ id: "adaptive" as const }] : []),
532-
],
533-
defaultLevel: claude46ModelRe.test(modelId.trim()) ? "adaptive" : undefined,
534-
}),
548+
resolveThinkingProfile: ({ modelId }) => resolveBedrockClaudeThinkingProfile(modelId),
535549
});
536550
}

0 commit comments

Comments
 (0)