Refactor to improve separation of concerns:
- Create src/services/router-models/index.ts to handle provider model fetching
- Extract buildProviderFetchList() function for fetch options construction
- Extract fetchRouterModels() function for coordinated model fetching
- Move 150+ lines of provider-specific logic out of webviewMessageHandler
- Add comprehensive tests in router-models-service.spec.ts (11 test cases)
Benefits:
- Cleaner webviewMessageHandler with less business logic
- Reusable service for router model operations
- Better testability with isolated unit tests
- Clear separation between UI message handling and data fetching
Files changed:
- New: src/services/router-models/index.ts
- New: src/services/router-models/__tests__/router-models-service.spec.ts
- Modified: src/core/webview/webviewMessageHandler.ts (simplified)
Address review feedback by removing out-of-scope optimizations:
1. Remove in-flight coalescing infrastructure
- Delete inFlightModelFetches and inFlightEndpointFetches maps
- Eliminate promise sharing across concurrent requests
2. Remove background refresh on file cache hit
- Simplify to synchronous flow: memory → file → network
- No more fire-and-forget background updates
3. Remove cache performance logging
- Delete console.log statements for cache_hit, file_hit, bg_refresh
- Clean up debugging artifacts from development
4. Fix active-provider scoping gap
- Include ollama/lmstudio/huggingface in requestRouterModels when active
- Prevents empty response that breaks chat flows for local providers
Result: Simpler, more maintainable code focused on core goal of
reducing unnecessary network requests by scoping to active provider.
Address review feedback:
1. Remove in-flight coalescing logic (out of scope for this PR)
- Remove inFlightModelFetches map and related logic from modelCache.ts
- Remove inFlightEndpointFetches map and related logic from modelEndpointCache.ts
- Remove background refresh on file cache hit
- Simplify to: memory cache → file cache → network fetch
2. Fix active-provider scoping gap for local providers
- Include ollama/lmstudio/huggingface in allFetches when they are the active provider
- Prevents empty routerModels response that breaks chat flows for these providers
The PR now focuses solely on its primary goal: scope model fetching to
the active provider to reduce unnecessary network requests.
- Update litellm, lmstudio, modelCache, and vercel-ai-gateway tests
- Tests now expect optional AbortSignal parameter (undefined when not provided)
- All 52 tests in affected files now passing
- Remove inline withTimeout helper in favor of AbortSignal.timeout()
- Add optional AbortSignal parameter to all provider model fetchers:
- openrouter, requesty, glama, unbound, litellm, ollama, lmstudio
- deepinfra, io-intelligence, vercel-ai-gateway, huggingface, roo
- Standardize timeout handling across modelCache and modelEndpointCache
- Add useRouterModelsAll hook for settings UI to fetch all providers
- Update Unbound and ApiOptions to use requestRouterModelsAll
This ensures consistent cancellation behavior and prepares for better
request lifecycle management across the codebase.
Implements Phase 1/2/3 from temp plan: 1) Coalesce in-flight per-provider fetches with timeouts in modelCache and modelEndpointCache; 2) Read file cache on memory miss (Option A) with background refresh; 3) Scope router-models to active provider by default and add requestRouterModelsAll for activation/settings; 4) Debounce requestRouterModels to reduce duplicates. Also removes immediate re-read after write and adds small logging for OpenRouter fetch counts. Test adjustments ensure deterministic behavior in CI by disabling debounce in NODE_ENV=test and fetching all providers in unit test paths.
Key changes: - src/api/providers/fetchers/modelCache.ts: add inFlightModelFetches and withTimeout; consult file cache on miss; remove immediate re-read after write; telemetry-style console logs - src/api/providers/fetchers/modelEndpointCache.ts: add inFlightEndpointFetches and withTimeout; consult file cache on miss - src/core/webview/webviewMessageHandler.ts: add requestRouterModelsAll; default requestRouterModels to active provider; debounce; warm caches on activation; NODE_ENV=test disables debounce and runs allFetches so tests remain stable - src/shared/WebviewMessage.ts: add 'requestRouterModelsAll' message type - src/shared/ExtensionMessage.ts: move includeCurrentTime/includeCurrentCost to optional fields - src/api/providers/openrouter.ts: log models/endpoints count after fetch - tests: update webviewMessageHandler.spec to use requestRouterModelsAll where full sweep is expected
Working directory summary: M src/api/providers/fetchers/modelCache.ts, M src/api/providers/fetchers/modelEndpointCache.ts, M src/api/providers/openrouter.ts, M src/core/webview/webviewMessageHandler.ts, M src/shared/ExtensionMessage.ts, M src/shared/WebviewMessage.ts, M src/core/webview/__tests__/webviewMessageHandler.spec.ts. Excluded: temp_plan.md (not committed).
* feat: update Gemini models with latest 09-2025 versions
- Add gemini-flash-latest and gemini-flash-lite-latest models
- Add gemini-2.5-flash-preview-09-2025 and gemini-2.5-flash-lite-preview-09-2025
- Reorganize models list with most recent versions at the top
- Maintain all existing models for backward compatibility
Fixes#8485
* fix: restore missing maxThinkingTokens and supportsReasoningBudget for gemini-2.5-pro-preview-03-25
Backward compatibility regression fix - these properties were accidentally
removed during reorganization and are required to preserve existing
reasoning-budget controls for users pinned to this model version.
---------
Co-authored-by: Roo Code <roomote@roocode.com>
Co-authored-by: daniel-lxs <ricciodaniel98@gmail.com>
* feat: Add supportsReasoning property for Z.ai GLM binary thinking mode
- Add supportsReasoning to ModelInfo schema for binary reasoning models
- Update GLM-4.5 and GLM-4.6 models to use supportsReasoning: true
- Implement thinking parameter support in ZAiHandler for Deep Thinking API
- Update ThinkingBudget component to show simple toggle for supportsReasoning models
- Add comprehensive tests for binary reasoning functionality
Closes#8465
* refactor: rename supportsReasoning to supportsReasoningBinary for clarity
- Rename supportsReasoning -> supportsReasoningBinary in model schema
- Update Z.AI GLM model configurations to use supportsReasoningBinary
- Update Z.AI provider logic in createStream and completePrompt methods
- Update ThinkingBudget UI component and tests
- Update all test comments and expectations
This change improves naming clarity by distinguishing between:
- supportsReasoningBinary: Simple on/off reasoning toggle
- supportsReasoningBudget: Advanced reasoning with token budget controls
- supportsReasoningEffort: Advanced reasoning with effort levels
* Use monotonic clock for rate limiting
* Fix LiteLLM test failures after merge
- Remove supportsComputerUse from LiteLLM implementation as it's no longer part of ModelInfo interface
- Update test expectations to include cacheWritesPrice and cacheReadsPrice fields
- Fix test for max_output_tokens preference functionality
---------
Co-authored-by: Christiaan Arnoldus <christiaan.arnoldus@outlook.com>
* changeset version bump
* Update CHANGELOG for version 3.29.1 release
Updated version number and added release notes for 3.29.1.
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
- Add responsive breakpoint at 300px for compact view
- Icon correctly reflects state (X when off, ✓ when on) at all screen sizes
- Show abbreviated labels on very narrow screens (< 300px)
- Add triggerLabelOffShort translation key to all locales
Fixes issues from PR #8152:
- Icon always showing checkmark on narrow screens
- Breakpoint activating too early (was 400px)
- Incorrect Tailwind class ordering