From cbcc75f6c7e0d9e005ae2ba36f1e6325a4922622 Mon Sep 17 00:00:00 2001 From: Clawborn Date: Fri, 20 Feb 2026 11:54:52 +0800 Subject: [PATCH] Add Claude Sonnet 4.6 and 4.5 to GitHub Copilot model catalog (openclaw#20270) thanks @Clawborn Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> --- CHANGELOG.md | 1 + src/providers/github-copilot-models.test.ts | 39 +++++++++++++++++++++ src/providers/github-copilot-models.ts | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 src/providers/github-copilot-models.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 93ce8c4cb..54daaf71c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Providers/Copilot: add `claude-sonnet-4.6` and `claude-sonnet-4.5` to the default GitHub Copilot model catalog and add coverage for model-list/definition helpers. (#20270, fixes #20091) Thanks @Clawborn. - Config/Agents: expose Pi compaction tuning values `agents.defaults.compaction.reserveTokens` and `agents.defaults.compaction.keepRecentTokens` in config schema/types and apply them in embedded Pi runner settings overrides with floor enforcement via `reserveTokensFloor`. (#21568) Thanks @Takhoffman. - Auto-reply/WebChat: avoid defaulting inbound runtime channel labels to unrelated providers (for example `whatsapp`) for webchat sessions so channel-specific formatting guidance stays accurate. (#21534) Thanks @lbo728. - Status: include persisted `cacheRead`/`cacheWrite` in session summaries so compact `/status` output consistently shows cache hit percentages from real session data. diff --git a/src/providers/github-copilot-models.test.ts b/src/providers/github-copilot-models.test.ts new file mode 100644 index 000000000..618035e98 --- /dev/null +++ b/src/providers/github-copilot-models.test.ts @@ -0,0 +1,39 @@ +import { describe, expect, it } from "vitest"; +import { buildCopilotModelDefinition, getDefaultCopilotModelIds } from "./github-copilot-models.js"; + +describe("github-copilot-models", () => { + describe("getDefaultCopilotModelIds", () => { + it("includes claude-sonnet-4.6", () => { + expect(getDefaultCopilotModelIds()).toContain("claude-sonnet-4.6"); + }); + + it("includes claude-sonnet-4.5", () => { + expect(getDefaultCopilotModelIds()).toContain("claude-sonnet-4.5"); + }); + + it("returns a mutable copy", () => { + const a = getDefaultCopilotModelIds(); + const b = getDefaultCopilotModelIds(); + expect(a).not.toBe(b); + expect(a).toEqual(b); + }); + }); + + describe("buildCopilotModelDefinition", () => { + it("builds a valid definition for claude-sonnet-4.6", () => { + const def = buildCopilotModelDefinition("claude-sonnet-4.6"); + expect(def.id).toBe("claude-sonnet-4.6"); + expect(def.api).toBe("openai-responses"); + }); + + it("trims whitespace from model id", () => { + const def = buildCopilotModelDefinition(" gpt-4o "); + expect(def.id).toBe("gpt-4o"); + }); + + it("throws on empty model id", () => { + expect(() => buildCopilotModelDefinition("")).toThrow("Model id required"); + expect(() => buildCopilotModelDefinition(" ")).toThrow("Model id required"); + }); + }); +}); diff --git a/src/providers/github-copilot-models.ts b/src/providers/github-copilot-models.ts index 700df6aaa..c4af8fadb 100644 --- a/src/providers/github-copilot-models.ts +++ b/src/providers/github-copilot-models.ts @@ -7,6 +7,8 @@ const DEFAULT_MAX_TOKENS = 8192; // We keep this list intentionally broad; if a model isn't available Copilot will // return an error and users can remove it from their config. const DEFAULT_MODEL_IDS = [ + "claude-sonnet-4.6", + "claude-sonnet-4.5", "gpt-4o", "gpt-4.1", "gpt-4.1-mini",