Skip to content

fix(vscode-lm): reliable auto context condensing + 3.53.1#11

Merged
simurg79 merged 2 commits into
mainfrom
fix/vscode-lm-condense
Jun 23, 2026
Merged

fix(vscode-lm): reliable auto context condensing + 3.53.1#11
simurg79 merged 2 commits into
mainfrom
fix/vscode-lm-condense

Conversation

@simurg79

Copy link
Copy Markdown
Owner

Fixes unreliable automatic context condensing on the VS Code LM (vscode-lm) provider.

Bertan Ari added 2 commits June 22, 2026 11:02
Treat maxTokens:-1 (unlimited) as the default output reserve instead of a hard cap, and measure contextPercent against available input space so the condense gate fires reliably on the VS Code LM provider.

Add a getCondenseContextWindow() seam that drives the condense gate from the curated model maxInputTokens rather than the inflated live context window.

Refresh the VS Code LM model catalog and update the default model.

Bump the extension to 3.53.1 and add the vscode-lm-condense-fix changeset.
Restores the upstream v3.54.0 changeset that was removed in 8ed3455; that file originated upstream (Release v3.54.0 RooCodeInc#12369) and should not have been deleted.
@simurg79
simurg79 merged commit 51affc1 into main Jun 23, 2026
7 checks passed
easonLiangWorldedtech pushed a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Jul 1, 2026
* fix(vscode-lm): reliable auto context condensing

Port of simurg79/Roo-Code#11 into Zoo-Code.

* test(vscode-lm): cover condense-window edge branches for codecov/patch

Add targeted tests for the previously-uncovered ported branches: the availableInputTokens<=0 fallback to 100% in willManageContext/manageContext, getCondenseContextWindow() guard fallbacks, and the vscode-lm UI family-miss window resolution. Raises patch coverage to satisfy the codecov/patch 80% gate.

* chore(vscode-lm): address review — drop changeset, fix condense-window guard test

- Remove .changeset/vscode-lm-condense-fix.md (changesets are maintainer-managed per AGENTS.md; CodeRabbit flagged).

- Fix getCondenseContextWindow() non-positive-guard test so the selector family (claude-opus-4.8) drives the lookup and the zeroed static row actually exercises the maxInputTokens > 0 guard before falling back.

* fix(vscode-lm): scope available-input condense denominator to vscode-lm; address review

Address review feedback from edelauna on Zoo-Code-Org#710:
- Scope the available-input-space condense percent denominator to vscode-lm only (via the getCondenseContextWindow seam); all other providers keep dividing by the full context window. The maxTokens:-1 reserve guard remains global.
- Correct the misleading useSelectedModel comment: the gate's primary window is getCondenseContextWindow() (static maxInputTokens), not getModel().info.contextWindow.
- Strengthen the listed-family test with a claude-opus-4.8 case (contextWindow != maxInputTokens) to catch a field swap.

* docs(vscode-lm): tighten auto-condense comments

Simplify comments added in PR Zoo-Code-Org#710 to be brief and rationale-focused; no logic, assertions, or test values changed.

* test(vscode-lm): harden condense reserve-guard coverage

Address review: make the negative-reserve percent test discriminate the maxTokens>0 guard (-200000), and add a manageContext truncation-path test so both copies of the -1 reserve guard are covered. Test-only; no product code changed.

* test(task): fix Task.dispose teardown-race flake

Mock utils/storage and OutputInterceptor in Task.dispose.test.ts so dispose()'s unawaited cleanup chain cannot emit a late console.error during Vitest worker teardown (EnvironmentTeardownError: Closing rpc while onUserConsoleLog was pending). Test-only; no product code changed.

* refactor(vscode-lm): default-row condense fallback + shared contextPercent helper

getCondenseContextWindow() resolves the default vscode-lm row for an unknown/absent family (catalog drift) instead of the inflated live window; only a non-positive static maxInputTokens still falls back to it. Extract the duplicated contextPercent math shared by willManageContext and manageContext into computeContextPercent so the two stay in lockstep. Addresses PR review feedback.

---------

Co-authored-by: Bertan Ari <bertanari@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant