Skip to content

Commit e9abe2f

Browse files
author
Bertan Ari
committed
fix(vscode-lm): complete combined Copilot model port with safe input ceilings
1 parent 58341d8 commit e9abe2f

3 files changed

Lines changed: 33 additions & 33 deletions

File tree

‎packages/types/src/__tests__/vscode-llm.spec.ts‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ describe("vscodeLlmModels", () => {
1616
expect(vscodeLlmModels["gemini-2.5-pro"].maxInputTokens).toBe(108594)
1717
})
1818
it.each([
19-
["claude-opus-5", "Claude Opus 5", 935793, "advertised, unverified"],
20-
["claude-sonnet-5", "Claude Sonnet 5", 925449, "measured"],
21-
["gpt-5.6-luna", "GPT-5.6 Luna", 199753, "measured"],
22-
["gpt-5.6-sol", "GPT-5.6 Sol", 271785, "measured"],
23-
["gpt-5.6-terra", "GPT-5.6 Terra", 271785, "measured"],
24-
["gemini-3.6-flash", "Gemini 3.6 Flash", 935793, "advertised, unverified"],
25-
] as const)("preserves PR #13 row %s (%s), limit %i (%s)", (...[family, name, limit]) => {
19+
["claude-opus-5", "Claude Opus 5", 935793, 197897],
20+
["claude-sonnet-5", "Claude Sonnet 5", 925449, 925449],
21+
["gpt-5.6-luna", "GPT-5.6 Luna", 199753, 199753],
22+
["gpt-5.6-sol", "GPT-5.6 Sol", 271785, 271785],
23+
["gpt-5.6-terra", "GPT-5.6 Terra", 271785, 271785],
24+
["gemini-3.6-flash", "Gemini 3.6 Flash", 935793, 197897],
25+
] as const)("preserves PR #13 row %s (%s) with PR #14 ceilings", (family, name, contextWindow, maxInputTokens) => {
2626
expect(vscodeLlmModels[family]).toEqual({
27-
contextWindow: limit,
27+
contextWindow,
2828
supportsImages: true,
2929
supportsPromptCache: false,
3030
inputPrice: 0,
@@ -33,7 +33,7 @@ describe("vscodeLlmModels", () => {
3333
version: family,
3434
name,
3535
supportsToolCalling: true,
36-
maxInputTokens: limit,
36+
maxInputTokens,
3737
})
3838
})
3939

‎packages/types/src/providers/vscode-llm.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ export type VscodeLlmModelId = keyof typeof vscodeLlmModels
1414

1515
export const vscodeLlmDefaultModelId: VscodeLlmModelId = "claude-sonnet-4.5"
1616

17-
// Curated VS Code LM (GitHub Copilot) model catalog.
18-
// The API exposes only `maxInputTokens`; the UI and condense gate read that. `contextWindow` is
19-
// the advertised window, kept for rows where it diverges from the ceiling (e.g. claude-opus-4.8).
20-
// https://github.com/simurg79/Roo-Code/pull/13: sonnet-5 and gpt-5.6 limits were measured
21-
// by single-message binary search on VS Code 1.126.0 (2026-07-14). Opus-5 and gemini-3.6-flash
22-
// retain advertised, unverified limits from the Copilot model-picker cache (2026-07-26).
17+
// The UI and condense gate use maxInputTokens; contextWindow preserves the advertised window.
18+
// https://github.com/simurg79/Roo-Code/pull/13: sonnet-5 and gpt-5.6 were binary-searched.
19+
// https://github.com/simurg79/Roo-Code/pull/14: opus-5 and gemini-3.6-flash retain advertised
20+
// 935793 windows but conservatively reuse the 197897 ceiling measured on other models to avoid
21+
// request overflow; neither model's actual input ceiling has been measured.
2322
export const vscodeLlmModels = {
2423
"claude-opus-5": {
2524
contextWindow: 935793,
@@ -31,7 +30,7 @@ export const vscodeLlmModels = {
3130
version: "claude-opus-5",
3231
name: "Claude Opus 5",
3332
supportsToolCalling: true,
34-
maxInputTokens: 935793,
33+
maxInputTokens: 197897,
3534
},
3635
"claude-opus-4.8": {
3736
contextWindow: 679560,
@@ -247,7 +246,7 @@ export const vscodeLlmModels = {
247246
version: "gemini-3.6-flash",
248247
name: "Gemini 3.6 Flash",
249248
supportsToolCalling: true,
250-
maxInputTokens: 935793,
249+
maxInputTokens: 197897,
251250
},
252251
"gemini-3.1-pro-preview": {
253252
contextWindow: 197897,

‎webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,24 +1422,25 @@ describe("useSelectedModel", () => {
14221422
expect(result.current.info?.supportsImages).toBe(false)
14231423
})
14241424

1425-
it("pins a divergent family's contextWindow to maxInputTokens, not its advertised window", () => {
1426-
// claude-opus-4.8 is the row where contextWindow and maxInputTokens differ; a field swap to
1427-
// the advertised window would be caught here.
1428-
const family = "claude-opus-4.8"
1429-
const apiConfiguration: ProviderSettings = {
1430-
apiProvider: providerIdentifiers.vscodeLm,
1431-
vsCodeLmModelSelector: { vendor: "copilot", family },
1432-
}
1425+
it.each(["claude-opus-4.8", "claude-opus-5", "gemini-3.6-flash"] as const)(
1426+
"pins %s to the 197897 input ceiling, not its advertised window",
1427+
(family) => {
1428+
const apiConfiguration: ProviderSettings = {
1429+
apiProvider: providerIdentifiers.vscodeLm,
1430+
vsCodeLmModelSelector: { vendor: "copilot", family },
1431+
}
14331432

1434-
const wrapper = createWrapper()
1435-
const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper })
1433+
const wrapper = createWrapper()
1434+
const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper })
14361435

1437-
expect(result.current.provider).toBe(providerIdentifiers.vscodeLm)
1438-
expect(result.current.id).toBe(`copilot/${family}`)
1439-
expect(result.current.info?.contextWindow).toBe(vscodeLlmModels[family].maxInputTokens) // 197897
1440-
expect(result.current.info?.contextWindow).not.toBe(vscodeLlmModels[family].contextWindow) // NOT 679560
1441-
expect(result.current.info?.supportsImages).toBe(false)
1442-
})
1436+
expect(result.current.provider).toBe(providerIdentifiers.vscodeLm)
1437+
expect(result.current.id).toBe(`copilot/${family}`)
1438+
expect(result.current.info?.contextWindow).toBe(197897)
1439+
expect(result.current.info?.contextWindow).toBe(vscodeLlmModels[family].maxInputTokens)
1440+
expect(result.current.info?.contextWindow).not.toBe(vscodeLlmModels[family].contextWindow)
1441+
expect(result.current.info?.supportsImages).toBe(false)
1442+
},
1443+
)
14431444

14441445
it("falls back to the default model's window for an unlisted family (NOT 128000)", () => {
14451446
const apiConfiguration: ProviderSettings = {

0 commit comments

Comments
 (0)