-
Notifications
You must be signed in to change notification settings - Fork 212
fix(vscode-lm): reliable auto context condensing #710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1eadaea
fix(vscode-lm): reliable auto context condensing
62a556c
test(vscode-lm): cover condense-window edge branches for codecov/patch
e45155d
chore(vscode-lm): address review — drop changeset, fix condense-windo…
d128a5c
fix(vscode-lm): scope available-input condense denominator to vscode-…
30389d3
docs(vscode-lm): tighten auto-condense comments
83cf5a3
Merge branch 'main' into fix/vscode-lm-condense
simurg79 6e3c466
test(vscode-lm): harden condense reserve-guard coverage
211fe55
test(task): fix Task.dispose teardown-race flake
7447ab3
refactor(vscode-lm): default-row condense fallback + shared contextPe…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "zoo-code": patch | ||
| --- | ||
|
|
||
| Fix unreliable automatic context condensing on the VS Code LM (vscode-lm) provider. The condense gate now treats the provider's `maxTokens: -1` (unlimited) as the default output reserve and measures usage against available input space, and a new `getCondenseContextWindow()` seam makes the gate use the curated model `maxInputTokens` instead of the inflated live window. Also refreshes the VS Code LM model catalog and default model. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { describe, it, expect } from "vitest" | ||
| import { vscodeLlmModels, vscodeLlmDefaultModelId } from "../providers/vscode-llm.js" | ||
|
|
||
| describe("vscodeLlmModels", () => { | ||
| it("exposes the opus-4.8 row with its measured maxInputTokens and contextWindow", () => { | ||
| // The VS Code LM API exposes only maxInputTokens; that is the value the UI reads from this | ||
| // table (useSelectedModel.ts). For claude-opus-4.8 the two fields intentionally DIVERGE: | ||
| // maxInputTokens (197897) is the enforced input ceiling, while contextWindow (679560) records | ||
| // the larger advertised window. The UI reads maxInputTokens, so the divergence is a deliberate | ||
| // tripwire — assert the actual on-disk literals rather than forcing equality. | ||
| expect(vscodeLlmModels).toHaveProperty("claude-opus-4.8") | ||
| expect(vscodeLlmModels["claude-opus-4.8"].contextWindow).toBe(679560) | ||
| expect(vscodeLlmModels["claude-opus-4.8"].maxInputTokens).toBe(197897) | ||
| }) | ||
| it("preserves the real window for models captured with a smaller maxInputTokens", () => { | ||
| expect(vscodeLlmModels["gpt-4o-mini"].maxInputTokens).toBe(12078) | ||
| expect(vscodeLlmModels["gpt-4o-mini"].contextWindow).toBe(12078) | ||
| expect(vscodeLlmModels["gemini-2.5-pro"].contextWindow).toBe(108594) | ||
| expect(vscodeLlmModels["gemini-2.5-pro"].maxInputTokens).toBe(108594) | ||
| }) | ||
| it("keeps both window fields populated and positive for every row", () => { | ||
| for (const [family, model] of Object.entries(vscodeLlmModels)) { | ||
| expect(model.contextWindow, `${family}: contextWindow must be a positive integer`).toBeGreaterThan(0) | ||
| expect(model.maxInputTokens, `${family}: maxInputTokens must be a positive integer`).toBeGreaterThan(0) | ||
| } | ||
| }) | ||
| it("excludes fabricated/internal/alias families and the dropped legacy rows", () => { | ||
| expect(vscodeLlmModels).not.toHaveProperty("claude-opus-4.7-high") | ||
| expect(vscodeLlmModels).not.toHaveProperty("claude-3.5-sonnet") | ||
| expect(vscodeLlmModels).not.toHaveProperty("claude-4-sonnet") | ||
| }) | ||
| it("defaults to a model id that exists in the table", () => { | ||
| expect(vscodeLlmDefaultModelId).toBe("claude-sonnet-4.5") | ||
| expect(vscodeLlmModels).toHaveProperty(vscodeLlmDefaultModelId) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.