Skip to content

feat: enrich auto-router model capabilities from lowest common denominator - #44

Open
Rahulsharma0810 wants to merge 1 commit into
Alph4d0g:mainfrom
Rahulsharma0810:feat/auto-model-capability-enrichment
Open

Rahulsharma0810 wants to merge 1 commit into
Alph4d0g:mainfrom
Rahulsharma0810:feat/auto-model-capability-enrichment

Conversation

@Rahulsharma0810

Copy link
Copy Markdown

Resolves #43.

OmniRoute's zero-config auto router model isn't listed in /api/combos like user-defined combos, so it previously surfaced with no computed context window or capabilities — requiring a manual modelMetadata override, exactly the kind of hardcoded workaround #43 is about.

Changes

  • src/omniroute-combos.ts: adds isAutoModel(model) and enrichAutoModel(models). When an auto model is present and missing contextWindow/maxTokens, computes them as the minimum across all other fetched models (same lowest-common-denominator approach as combo enrichment). Capability booleans: AND for vision/tools/streaming/temperature/attachment, OR for reasoning. Never overrides values already set (from the API or user overrides) — only fills gaps.
  • src/models.ts: wires enrichAutoModel in as the final step of enrichModelMetadata(), after enrichComboModels.
  • test/auto-model.test.mjs: 5 new test cases covering matching, LCD computation, no-op when no auto model, non-override behavior, and partial-fill behavior.
  • README.md / CHANGELOG.md updated.

Test plan

  • npm run build — 0 errors
  • npm test — 71/71 passing (66 pre-existing + 5 new)

…nator

Resolves Alph4d0g#43 — OmniRoute's zero-config `auto` router model isn't listed
in /api/combos like user-defined combos, so it previously had no computed
context window / capabilities, requiring a manual modelMetadata override.

Adds isAutoModel()/enrichAutoModel() in src/omniroute-combos.ts, following
the same lowest-common-denominator approach already used for combo
enrichment: contextWindow/maxTokens are set to the minimum across all
other fetched models, capability booleans use AND (vision/tools/streaming/
temperature/attachment) or OR (reasoning) as appropriate. Existing values
(from the API or user overrides) are never overwritten.

5 new tests in test/auto-model.test.mjs, 71/71 total passing.
Comment thread src/omniroute-combos.ts
...autoModel,
...(computedContextWindow !== undefined ? { contextWindow: computedContextWindow } : {}),
...(computedMaxTokens !== undefined ? { maxTokens: computedMaxTokens } : {}),
supportsVision: autoModel.supportsVision ?? others.every((m) => m.supportsVision === true),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔥 The Roast: The "lowest common denominator" AND logic treats undefined as false. Every other model in your catalog that merely lacks a resolved capability — e.g. a custom provider model not found in models.dev, which leaves supportsVision/supportsTools/etc. undefined — poisons the AND into false. So adding any single model with unknown capabilities silently flips vision/tools/streaming off for the auto router. Meanwhile the combo path this claims to mirror (calculateLowestCommonCapabilities in models-dev.ts:444) explicitly guards with hasTemperatureMetadata/hasReasoningMetadata so missing metadata doesn't drag results down. This isn't even consistent with its own inspiration.

🩹 The Fix: Ignore models whose capability is unknown when computing the AND, e.g. const visionKnown = others.filter(m => m.supportsVision !== undefined); supportsVision: autoModel.supportsVision ?? (visionKnown.length ? visionKnown.every(m => m.supportsVision === true) : undefined). Apply the same pattern to the other five booleans (reasoning should stay OR, also ignoring unknown). This matches the combo behavior's "don't punish missing metadata" intent.

📏 Severity: warning


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread src/omniroute-combos.ts
* "other models" pool already has resolved capabilities where possible.
*/
export function enrichAutoModel(models: OmniRouteModel[]): OmniRouteModel[] {
const autoIndex = models.findIndex(isAutoModel);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔥 The Roast: findIndex(isAutoModel) enriches only the first auto model, then the others filter excludes every other auto model via !isAutoModel(model). So if the catalog ever contains two auto routers (e.g. auto and omniroute/auto, or two providers' auto), the first wins and the rest are quietly left as empty shells — excluded from the pool and never enriched themselves. It's a coin-flip which one gets capabilities.

🩹 The Fix: Pick a single canonical auto model (prefer bare auto over provider/auto, or merge all matched auto models) instead of enriching only findIndex's first hit and discarding the rest.

📏 Severity: suggestion


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread README.md
OmniRoute itself ever starts returning explicit capabilities for `auto` (or you set them via
`modelMetadata` overrides), those take precedence and this calculation is skipped.

### API Mode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔥 The Roast: The new Auto-Router sectiongot a little too eager and stamped ### API Mode twice. Two identical headings now sit back-to-back like a copy-paste that forgot to press delete. Anyone following the TOC will think they've fallen into a documentation time loop.

🩹 The Fix: Remove the duplicate ### API Mode heading this PR added (keep the original one that introduces the API Modes content).

📏 Severity: nitpick


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Roast 🔥

Verdict: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
🚨 critical 0
⚠️ warning 1
💡 suggestion 1
🤏 nitpick 1
Issue Details (click to expand)
File Line Roast
src/omniroute-combos.ts 392 AND-over-capabilities treats undefined as false, so any catalog model with unknown capability metadata drags the auto router's vision/tools/etc. to false (and diverges from combo's hasMetadata guards)
src/omniroute-combos.ts 361 findIndex(isAutoModel) + !isAutoModel filter only enriches the first auto model and discards any others
README.md 227 Duplicate ### API Mode heading introduced by the new section

🏆 Best part: The overall approach is genuinely clean — reusing splitModelId, mirroring the combo LCD pattern, respecting pre-existing/API values via ??, and shipping 5 focused tests. I'm surprised I didn't have to reach for the flamethrower on the core design.

💀 Worst part: The capability AND logic poisons itself on undefined (line 392). One custom model without resolved metadata and your auto router quietly loses vision/tools/streaming — a real footgun, and it's not even consistent with the combo code it claims to mirror.

📊 Overall: Like a soufflé that rose beautifully but collapsed because one ingredient was "unknown" — the recipe's right, but the undefined-as-false shortcut needs fixing before it ships.

Files Reviewed (5 files)
  • CHANGELOG.md - 0 issues
  • README.md - 1 issue (nitpick)
  • src/models.ts - 0 issues
  • src/omniroute-combos.ts - 2 issues (warning, suggestion)
  • test/auto-model.test.mjs - 0 issues

Fix these issues in Kilo Cloud


Reviewed by free · Input: 80.1K · Output: 12.1K · Cached: 187.1K

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.

Solution of Context window declaration

2 participants