Skip to content

Commit 011f007

Browse files
committed
fix(github-copilot): expose Claude thinking levels
1 parent 7aa3585 commit 011f007

4 files changed

Lines changed: 15 additions & 22 deletions

File tree

‎extensions/github-copilot/models.test.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,17 @@ describe("resolveCopilotForwardCompatModel", () => {
183183
}
184184
});
185185

186+
it("infers reasoning=true for Claude model IDs routed through Anthropic Messages", () => {
187+
for (const id of ["claude-haiku-4.5", "claude-sonnet-4.6", "claude-opus-4.8"]) {
188+
const ctx = createMockCtx(id);
189+
const result = requireResolvedModel(ctx);
190+
expect(result.api).toBe("anthropic-messages");
191+
expect((result as unknown as Record<string, unknown>).reasoning).toBe(true);
192+
}
193+
});
194+
186195
it("sets reasoning=false for non-reasoning model IDs including mid-string o1/o3", () => {
187-
for (const id of [
188-
"gpt-5.4-mini",
189-
"claude-sonnet-4.6",
190-
"gpt-4o",
191-
"mycodexmodel",
192-
"audio-o1-hd",
193-
"turbo-o3-voice",
194-
]) {
196+
for (const id of ["gpt-5.4-mini", "gpt-4o", "mycodexmodel", "audio-o1-hd", "turbo-o3-voice"]) {
195197
const ctx = createMockCtx(id);
196198
const result = requireResolvedModel(ctx);
197199
expect((result as unknown as Record<string, unknown>).reasoning).toBe(false);

‎extensions/github-copilot/models.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,17 @@ export function resolveCopilotForwardCompatModel(
9393
// model isn't available on the user's plan. This lets new models be used
9494
// by simply adding them to agents.defaults.models in openclaw.json — no
9595
// code change required.
96+
const api = resolveCopilotTransportApi(trimmedModelId);
9697
const reasoning =
9798
/^o[13](\b|$)/.test(lowerModelId) ||
9899
isCopilotCodexModelId(lowerModelId) ||
99-
resolveCopilotTransportApi(trimmedModelId) === "anthropic-messages";
100+
api === "anthropic-messages";
100101
const compat = resolveCopilotModelCompat(trimmedModelId);
101102
return normalizeModelCompat({
102103
id: trimmedModelId,
103104
name: trimmedModelId,
104105
provider: PROVIDER_ID,
105-
api: resolveCopilotTransportApi(trimmedModelId),
106+
api,
106107
reasoning,
107108
// Optimistic: most Copilot models support images, and the API rejects
108109
// image payloads for text-only models rather than failing silently.

‎extensions/github-copilot/provider-policy-api.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("github-copilot provider-policy-api", () => {
77
expect(
88
resolveThinkingProfile({
99
provider: "github-copilot",
10-
modelId: "claude-opus-4.6",
10+
modelId: "claude-sonnet-4.6",
1111
})?.levels.map((level) => level.id),
1212
).toEqual(["off", "minimal", "low", "medium", "high"]);
1313
});

‎src/plugins/provider-thinking.ts‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Resolves provider thinking-level policy from plugin metadata.
22
import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id";
33
import { resolveBundledProviderPolicySurface } from "./provider-public-artifacts.js";
4-
import { resolveProviderRuntimePlugin } from "./provider-runtime.js";
54
import type {
65
ProviderDefaultThinkingPolicyContext,
76
ProviderThinkingProfile,
@@ -87,16 +86,7 @@ export function resolveProviderThinkingProfile(
8786
if (activeProfile !== undefined) {
8887
return activeProfile;
8988
}
90-
const bundledProfile = resolveBundledProviderPolicySurface(
91-
params.provider,
92-
)?.resolveThinkingProfile?.(params.context);
93-
if (bundledProfile !== undefined) {
94-
return bundledProfile;
95-
}
96-
// Fall back to the runtime plugin registry for providers that register
97-
// thinking hooks through the SDK (e.g. github-copilot) rather than the
98-
// legacy PLUGIN_REGISTRY_STATE path.
99-
return resolveProviderRuntimePlugin({ provider: params.provider })?.resolveThinkingProfile?.(
89+
return resolveBundledProviderPolicySurface(params.provider)?.resolveThinkingProfile?.(
10090
params.context,
10191
);
10292
}

0 commit comments

Comments
 (0)