Skip to content

feat(core): configure model routing by request complexity - #1

Open
ivanmilevtues wants to merge 1 commit into
mainfrom
demo/configurable-model-routing
Open

ivanmilevtues wants to merge 1 commit into
mainfrom
demo/configurable-model-routing

Conversation

@ivanmilevtues

Copy link
Copy Markdown
Member

Summary

Allow users to map request complexity scores to model IDs or aliases through routing.numericalRules. For example, simple requests can use a lightweight model while more complex requests use Pro. Without custom rules, existing threshold-based behavior remains.

This is a CodeBoarding demonstration PR, not intended to merge, following the approach of CodeBoarding/pi#2. It contains 802 additions and 18 deletions across 13 files.

Details

Adapted directly from google-gemini/gemini-cli#29959 by gitseraj, preserving the original commit and authorship.

Custom score bands are sorted by their inclusive upper boundaries, resolve model aliases, and respect model availability. Scores above the final band use that band's model. Custom numerical routing is prioritized ahead of the generic classifier when configured; the existing numerical-routing enablement gate still applies.

Useful paths to explore in the architecture analysis:

  • CLI settings → core configuration: the settings schema and CLI loader carry user-defined routing rules into Config.
  • Core configuration → model router: configured rules alter strategy ordering in ModelRouterService.
  • Numerical classifier → model resolution and availability: complexity scores select custom bands, resolve aliases, and check model health before returning a routing decision.
  • Settings schema → validation and generated schema: configuration changes propagate into validation tests, JSON schema, and documentation.

The fork currently has no CodeBoarding Actions workflow. This PR provides the code change for analysis; no successful CodeBoarding analysis is claimed.

Related Issues

Related to google-gemini/gemini-cli#21805. This demonstration does not close the upstream issue.

How to Validate

Completed locally on macOS:

  • Core build: npm run generate && npm run build -w @google/gemini-cli-core — passed.
  • In packages/core: npx vitest run --coverage.enabled=false src/routing/strategies/numericalClassifierStrategy.test.ts src/routing/modelRouterService.test.ts src/config/config.test.ts — 305 tests passed.
  • In packages/cli: npx vitest run --coverage.enabled=false src/config/settings-validation.test.ts — 37 tests passed.
  • ESLint on all changed TypeScript files — passed.
  • Prettier on all changed files — passed.
  • git diff --check main...HEAD — passed.

Coverage includes score boundaries, unsorted rules, invalid rules, final-band fallback, default behavior, strategy precedence, and settings validation. Full repository preflight and live model API tests were not run for this time-sensitive demo.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any): none intended; no-rule behavior is preserved
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T13:37:49.235219Z d24b07b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants