Skip to content

feat: add capability flags to custom provider models#1387

Open
brunobuddy wants to merge 1 commit intomainfrom
capabilities
Open

feat: add capability flags to custom provider models#1387
brunobuddy wants to merge 1 commit intomainfrom
capabilities

Conversation

@brunobuddy
Copy link
Copy Markdown
Member

@brunobuddy brunobuddy commented Mar 29, 2026

Summary

  • Adds optional capability_reasoning and capability_code boolean fields to the custom provider model schema (entity, DTO, service, model discovery)
  • Custom provider models now compute quality scores dynamically via computeQualityScore() instead of being hardcoded to score 2
  • Models with capability_reasoning: true are now eligible for the reasoning tier

This unblocks the use case described in #1047 — users routing built-in providers through a gateway proxy can now set capability flags on custom provider models so they receive proper quality scoring and tier assignment.

Backward-compatible: existing custom providers without these fields default to false (no behavior change). No database migration needed (JSON column).

Test plan

  • DTO validation tests: accepts booleans, rejects non-booleans
  • Service tests: capability flags pass through in create/update
  • Model discovery tests: reads flags from stored data, defaults to false for legacy data, computes quality score dynamically
  • E2E tests: creates provider with capability flags, verifies available-models reflects them with correct quality score
  • All 3137 backend unit tests pass
  • All 98 backend e2e tests pass
  • All 1700 frontend tests pass
  • 100% line coverage maintained

Closes #1047


Summary by cubic

Adds optional capability_reasoning and capability_code to custom provider models and switches them to dynamic quality scoring. This lets gateway-proxied models get correct scores and reasoning-tier eligibility (closes #1047).

  • New Features
    • Support capability_reasoning and capability_code across entity/DTO/service, surfaced via model discovery and frontend API types.
    • Compute quality scores with computeQualityScore(); remove fixed score of 2 for custom models.
    • Backward compatible: flags default to false; no migration needed (JSON column).

Written for commit 41d5871. Summary will update on new commits.

… models

Custom provider models had capability flags hardcoded to false, capping
quality scores at 2 and preventing them from being assigned to the
reasoning tier. This adds optional capability_reasoning and
capability_code boolean fields to the custom provider model schema,
enabling proper quality scoring and tier assignment for models served
through custom providers (e.g., gateway proxies).

Closes #1047
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.67%. Comparing base (5164c66) to head (41d5871).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1387   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files         117      117           
  Lines        7302     7302           
  Branches     2829     2829           
=======================================
  Hits         7205     7205           
  Misses         88       88           
  Partials        9        9           
Flag Coverage Δ
frontend 98.75% <ø> (ø)
manifest 97.72% <ø> (ø)
plugin 94.66% <ø> (ø)
shared 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 10 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/backend/src/model-discovery/model-discovery.service.ts">

<violation number="1" location="packages/backend/src/model-discovery/model-discovery.service.ts:239">
P2: Pass the raw custom model name into computeQualityScore; using the prefixed `modelKey` adds an extra slash segment that prevents QUALITY_OVERRIDES from matching vendor-prefixed names (e.g., `anthropic/claude-sonnet-4-20250514`), so those models get the wrong quality tier.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

capabilityReasoning: capReasoning,
capabilityCode: capCode,
qualityScore: computeQualityScore({
model_name: modelKey,
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 29, 2026

Choose a reason for hiding this comment

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

P2: Pass the raw custom model name into computeQualityScore; using the prefixed modelKey adds an extra slash segment that prevents QUALITY_OVERRIDES from matching vendor-prefixed names (e.g., anthropic/claude-sonnet-4-20250514), so those models get the wrong quality tier.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/backend/src/model-discovery/model-discovery.service.ts, line 239:

<comment>Pass the raw custom model name into computeQualityScore; using the prefixed `modelKey` adds an extra slash segment that prevents QUALITY_OVERRIDES from matching vendor-prefixed names (e.g., `anthropic/claude-sonnet-4-20250514`), so those models get the wrong quality tier.</comment>

<file context>
@@ -224,16 +224,25 @@ export class ModelDiscoveryService {
+          capabilityReasoning: capReasoning,
+          capabilityCode: capCode,
+          qualityScore: computeQualityScore({
+            model_name: modelKey,
+            input_price_per_token: inputPerToken,
+            output_price_per_token: outputPerToken,
</file context>
Suggested change
model_name: modelKey,
model_name: m.model_name,
Fix with Cubic

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.

1 participant