Skip to content

fix: honor specific-tier fallbacks in proxy path#1587

Merged
SebConejo merged 1 commit intomnfst:mainfrom
Nicolas-Formenton:fix/specific-tier-fallbacks
Apr 17, 2026
Merged

fix: honor specific-tier fallbacks in proxy path#1587
SebConejo merged 1 commit intomnfst:mainfrom
Nicolas-Formenton:fix/specific-tier-fallbacks

Conversation

@Nicolas-Formenton
Copy link
Copy Markdown
Contributor

@Nicolas-Formenton Nicolas-Formenton commented Apr 16, 2026

Summary

  • propagate fallback_models from specificity resolution
  • prefer those fallbacks in the proxy when a specificity-routed primary fails
  • add regression coverage for both resolve and proxy behavior

Why
Specific-tier fallbacks were persisted and configurable, but the runtime proxy path ignored them and only consulted general tier fallbacks.

What changed

  1. packages/backend/src/routing/dto/resolve-response.ts
  • add optional fallback_models?: string[] | null
  1. packages/backend/src/routing/resolve/resolve.service.ts
  • include assignment.fallback_models ?? null in resolveSpecificity(...)
  1. packages/backend/src/routing/proxy/proxy.service.ts
  • prefer resolved.fallback_models before general tier fallbacks
  1. tests
  • packages/backend/src/routing/resolve.service.spec.ts
    • assert specificity resolution propagates fallback models
  • packages/backend/src/routing/proxy/__tests__/proxy.service.spec.ts
    • assert a specificity-routed request uses its own fallback chain even when the general tier fallback list is null

Test plan

  • npm run build --workspace=packages/shared
  • npm test --workspace=packages/backend -- --runInBand src/routing/resolve.service.spec.ts src/routing/proxy/__tests__/proxy.service.spec.ts

Additional note
To run the targeted tests in this environment, I also had to fix a pre-existing strict-typing compile issue in packages/backend/src/routing/routing-core/tier.service.ts by annotating the TIERS.map(...) callback parameter as Tier. If you'd prefer, I can split that into a separate cleanup PR.

Closes #1586


Summary by cubic

Ensure specificity-routed requests use their own fallback chain when the primary model fails. Propagates per-assignment fallback_models through resolve and prefers them in the proxy, fixing incorrect tier fallback behavior.

  • Bug Fixes
    • Expose fallback_models on ResolveResponse and propagate from resolveSpecificity.
    • Proxy now prefers resolved.fallback_models before tier-level fallbacks.
    • Add regression tests for resolve and proxy fallback behavior.
    • Fix strict typing in tier.service.ts (TIERS.map callback typed as Tier).

Written for commit 4f91ccd. Summary will update on new commits.

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.

No issues found across 6 files

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.92%. Comparing base (67f8852) to head (4f91ccd).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1587   +/-   ##
=======================================
  Coverage   97.92%   97.92%           
=======================================
  Files         118      118           
  Lines        8675     8675           
  Branches     3265     3265           
=======================================
  Hits         8495     8495           
  Misses        178      178           
  Partials        2        2           
Flag Coverage Δ
frontend 97.91% <ø> (ø)
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.

@SebConejo SebConejo merged commit 0c8a327 into mnfst:main Apr 17, 2026
15 checks passed
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.

Specific-tier fallbacks are persisted but ignored by the proxy fallback path

2 participants