Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 19, 2025

Related GitHub Issue

Closes: #10214

Description

This PR attempts to address Issue #10214 by creating a centralized framework for applying model family defaults to tool preferences and settings across all providers.

Key implementation details:

  1. New model-family-defaults.ts module - Contains MODEL_FAMILY_REGISTRY array and applyModelFamilyDefaults() function

    • Uses first-match-wins pattern matching (more specific patterns first)
    • Currently includes Gemini 3, general Gemini, and OpenAI/GPT model families
    • Only applies defaults when properties are NOT already set (preserving explicit values)
  2. BaseProvider.applyModelDefaults() helper - Protected method available to all providers extending BaseProvider

  3. Updated all provider getModel() methods - Calls applyModelDefaults() to apply family-based tool preferences

  4. Removed router-tool-preferences.ts - Functionality consolidated into the new centralized module

Design decisions:

  • Granular precedence: Provider/model-specific settings take precedence over family defaults
  • Pattern-based matching: Regex patterns allow flexible model family matching
  • Extensible registry: New model families can be easily added to MODEL_FAMILY_REGISTRY

Test Procedure

  1. Unit tests added in src/api/providers/utils/__tests__/model-family-defaults.spec.ts
  2. All 25 tests pass
  3. TypeScript type checking passes
  4. Linting passes

To verify:

cd src && npx vitest run api/providers/utils/__tests__/model-family-defaults.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

Feedback and guidance are welcome. This is an initial implementation of the centralized framework for model family defaults.

…l providers

This PR addresses Issue #10214 by creating a centralized framework for
applying model family defaults to tool preferences and settings.

Key changes:
- Added model-family-defaults.ts with MODEL_FAMILY_REGISTRY and applyModelFamilyDefaults()
- Added applyModelDefaults() helper method to BaseProvider
- Updated all provider getModel() methods to apply family defaults
- Removed deprecated router-tool-preferences.ts (functionality consolidated)
- Added comprehensive tests for the model family defaults module

Model family defaults are applied granularly: provider/model-specific settings
take precedence over family defaults (only undefined properties get defaults).
@roomote
Copy link
Contributor Author

roomote bot commented Dec 19, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation is clean and well-tested:

  • New model-family-defaults.ts module with pattern-based model family matching
  • applyModelFamilyDefaults() correctly applies defaults only when properties are undefined
  • All 33+ provider files consistently integrated
  • 25 tests pass covering all model families and edge cases

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Centralize model family defaults for tool preferences and settings across all providers

3 participants