Skip to content

fix(backend): preserve compatible OpenRouter models#1121

Merged
brunobuddy merged 4 commits intomnfst:mainfrom
guillaumegay13:codex/fix-openrouter-available-models
Mar 14, 2026
Merged

fix(backend): preserve compatible OpenRouter models#1121
brunobuddy merged 4 commits intomnfst:mainfrom
guillaumegay13:codex/fix-openrouter-available-models

Conversation

@guillaumegay13
Copy link
Copy Markdown
Collaborator

@guillaumegay13 guillaumegay13 commented Mar 14, 2026

Summary

  • preserve OpenRouter-hosted vendor-prefixed models during local bootstrap and available-model resolution
  • store OpenRouter-hosted copies for vendor-prefixed models during pricing sync
  • filter out non-chat OpenRouter models based on modality metadata and delete stale incompatible rows

Why

OpenRouter-hosted models with vendor-prefixed IDs need to remain available locally, but image-output / non-chat models should not be proposed in Manifest's text model picker. This keeps OpenRouter chat models surfaced while removing incompatible entries like image-preview-only rows from the synced pricing table.

Testing

  • npm test --workspace=packages/backend -- --runInBand src/database/pricing-sync.service.spec.ts

Summary by cubic

Preserves chat‑compatible OpenRouter models, always creates OpenRouter‑hosted vendor‑prefixed copies with provider: 'OpenRouter', and filters non‑chat entries while avoiding canonical name collisions during cleanup.

  • New Features

    • Upsert an OpenRouter‑hosted copy for vendor‑prefixed models (e.g., openai/gpt-4o) alongside the canonical entry, with provider: 'OpenRouter'.
    • Local bootstrap and available‑model resolution keep OpenRouter provider models even if not curated; available models include vendor‑prefixed IDs when openrouter is active.
  • Bug Fixes

    • Modality filter for chat: require text input; allow multimodal input; enforce text‑only output.
    • Cleanup removes stale non‑chat entries and unsupported native vendor‑prefixed rows, but keeps OpenRouter‑hosted rows and canonicals; avoids deleting a compatible canonical when an incompatible alias shares the same name.

Written for commit 9acb4f3. Summary will update on new commits.

Fixes #1088

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.00%. Comparing base (bf5400a) to head (9acb4f3).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1121   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         224      224           
  Lines       11845    11869   +24     
  Branches     3749     3756    +7     
=======================================
+ Hits        11727    11751   +24     
  Misses         26       26           
  Partials       92       92           
Flag Coverage Δ
backend 98.55% <100.00%> (+<0.01%) ⬆️
frontend 99.77% <ø> (ø)
plugin 95.80% <ø> (ø)

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 5 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/database/pricing-sync.service.ts">

<violation number="1" location="packages/backend/src/database/pricing-sync.service.ts:101">
P2: Canonical name collision: an incompatible model's canonical name can shadow a compatible model from a different provider. When both `provider-a/model-x` (incompatible) and `provider-b/model-x` (compatible) exist, `model-x` ends up in `incompatibleNames` and `removeUnsupportedModels` deletes the row that `syncAllModels` just upserted for the compatible model.

Track compatible canonicals and exclude them from the incompatible set.</violation>
</file>

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

Comment thread packages/backend/src/database/pricing-sync.service.ts Outdated
@brunobuddy brunobuddy merged commit 93227c9 into mnfst:main Mar 14, 2026
13 checks passed
@guillaumegay13 guillaumegay13 deleted the codex/fix-openrouter-available-models branch March 19, 2026 13:34
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.

Missing OpenRouter models in Local Mode

2 participants