Skip to content

feat(core): support custom reasoning models by default#19227

Merged
NTaylorMullen merged 2 commits intomainfrom
ntm/custom-model-support
Feb 16, 2026
Merged

feat(core): support custom reasoning models by default#19227
NTaylorMullen merged 2 commits intomainfrom
ntm/custom-model-support

Conversation

@NTaylorMullen
Copy link
Collaborator

Summary

Refactor model feature gating to support custom/unknown reasoning models by default. Non-Gemini branded models are now treated as "modern" to enable features like thoughts and modern system prompts without hardcoding names.

Details

  • Added supportsModernFeatures and isCustomModel to identify non-Gemini branded models.
  • Updated PromptProvider, GeminiChat, and agents to use capability-based checks instead of hardcoded model lists.
  • Simplified snippets.ts by assuming modern capabilities when invoked.
  • Maintained legacy behavior for Gemini 2.x models.

Related Issues

N/A

How to Validate

  1. Run with a custom model name: gemini --model custom-model "Hello"
  2. Run unit tests: npm test -w @google/gemini-cli-core -- src/config/models.test.ts src/core/geminiChat.test.ts src/core/prompts.test.ts

Pre-Merge Checklist

  • Added/updated tests
  • Validated on MacOS

- Refactor model feature gating to use capability-based logic
- Introduce supportsModernFeatures and isCustomModel to identify models that should be treated as modern by default
- Update GeminiChat, PromptProvider, and CodebaseInvestigatorAgent to use the new logic
- Simplify snippets.ts by assuming modern capabilities for modern models
@NTaylorMullen NTaylorMullen requested a review from a team as a code owner February 16, 2026 20:38
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @NTaylorMullen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the flexibility of the system by shifting from explicit model-name-based feature gating to a more dynamic, capability-driven approach. This change allows the system to seamlessly integrate and leverage advanced features for custom or future reasoning models, improving extensibility and reducing the need for frequent updates when new models are introduced. The refactoring ensures that the system can intelligently adapt its behavior based on a model's inherent capabilities rather than its specific branding.

Highlights

  • Custom Model Support: Refactored model feature gating to inherently support custom or unknown reasoning models, treating them as 'modern' by default.
  • Modern Feature Enablement: Enabled advanced features like 'thoughts' and modern system prompts for non-Gemini branded models without requiring explicit naming.
  • Capability-Based Checks: Updated core components such as PromptProvider, GeminiChat, and agents to utilize capability-based checks (supportsModernFeatures, isCustomModel) instead of relying on hardcoded model lists.
  • Simplified Prompt Snippets: Simplified snippets.ts by assuming modern capabilities when invoked, streamlining prompt generation logic.
  • Legacy Model Compatibility: Ensured that legacy behavior is maintained for Gemini 2.x models, preserving backward compatibility.
Changelog
  • packages/core/src/agents/codebase-investigator.ts
    • Replaced isPreviewModel with supportsModernFeatures for model capability checks.
  • packages/core/src/config/models.test.ts
    • Added new test suites for isCustomModel to verify identification of non-Gemini models.
    • Added new test suites for supportsModernFeatures to confirm correct classification of modern and custom models.
  • packages/core/src/config/models.ts
    • Introduced isCustomModel function to identify models not prefixed with 'gemini-'.
    • Introduced supportsModernFeatures function to determine if a model (Gemini 3 or custom) supports modern capabilities.
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Removed extraneous blank lines within prompt snapshots, standardizing formatting.
  • packages/core/src/core/geminiChat.ts
    • Replaced isPreviewModel with supportsModernFeatures when determining content generation configuration.
  • packages/core/src/prompts/promptProvider.ts
    • Replaced isPreviewModel with supportsModernFeatures when selecting active prompt snippets.
    • Updated prompt composition logic to use isModernModel instead of isGemini3.
    • Removed isGemini3 parameter from coreMandates and operationalGuidelines options.
  • packages/core/src/prompts/snippets.ts
    • Removed isGemini3 property from CoreMandatesOptions and OperationalGuidelinesOptions interfaces.
    • Modified renderCoreMandates to unconditionally include the 'Explain Before Acting' mandate.
    • Modified renderOperationalGuidelines to unconditionally include the 'No Chitchat' mandate, removing conditional logic.
    • Removed the mandateExplainBeforeActing and toneAndStyleNoChitchat helper functions.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a well-thought-out refactoring to support custom reasoning models by default. By adding isCustomModel and supportsModernFeatures utility functions, the codebase moves from hardcoded model names to a more flexible capability-based feature gating. This change is consistently applied across agents, chat logic, and prompt providers. The simplification of snippets.ts to assume modern features, with PromptProvider selecting the appropriate snippet version, is a clean architectural choice. The accompanying tests for the new model logic are thorough. The changes look solid and effectively achieve the stated goal.

@github-actions
Copy link

Size Change: -102 B (0%)

Total Size: 24.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.4 MB -102 B (0%)
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

return '\n- **Conflict Resolution:** Instructions are provided in hierarchical context tags: `<global_context>`, `<extension_context>`, and `<project_context>`. In case of contradictory instructions, follow this priority: `<project_context>` (highest) > `<extension_context>` > `<global_context>` (lowest).';
}

function mandateExplainBeforeActing(isGemini3: boolean): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not need to check this anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! This prompt is only called for Gemini 3 models and custom models anyways. Was legacy 😁

snippets.legacy.ts is used for 2.5 series

@NTaylorMullen NTaylorMullen added this pull request to the merge queue Feb 16, 2026
@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 16, 2026
Merged via the queue into main with commit 39d3610 Feb 16, 2026
29 checks passed
@NTaylorMullen NTaylorMullen deleted the ntm/custom-model-support branch February 16, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants