fix: subscription probe no longer filters accessible models (#1448)#1451
Open
Fixxu wants to merge 1 commit intomnfst:mainfrom
Open
fix: subscription probe no longer filters accessible models (#1448)#1451Fixxu wants to merge 1 commit intomnfst:mainfrom
Fixxu wants to merge 1 commit intomnfst:mainfrom
Conversation
The Anthropic subscription probe was treating all HTTP 400 responses as 'subscription tier doesn't include this model family.' This incorrectly removed sonnet and opus from the model picker for subscription users. The real cause was invalid_request_error (a probe format issue), not a tier restriction. The fix parses the error response body and only filters models for genuine permission/authentication errors. - Parse error type from response body before filtering - Only treat authentication_error, permission_error, not_found_error as blocked - Treat invalid_request_error as inconclusive (keep the model) - Wrap probe call in try/catch for graceful degradation - Updated and added tests for all scenarios
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1451 +/- ##
=======================================
Coverage 98.68% 98.68%
=======================================
Files 117 117
Lines 7349 7349
Branches 2855 2855
=======================================
Hits 7252 7252
Misses 88 88
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a user connects with a Claude.ai subscription token (OAuth
sk-ant-oat-*), the model discovery probe incorrectly filters out sonnet and opus model families from the model picker. Users with valid Claude Max/Pro subscriptions can only see haiku models.Reported in: #1448
Root Cause
The
probeModel()function inanthropic-subscription-probe.tstreats all HTTP 400 responses as "subscription tier doesn't include this model family":But Anthropic returns 400/
invalid_request_errorfor probe format issues — not tier restrictions. The probe never reads the error response body to distinguish between the two.Fix
authentication_error,permission_error,not_found_errorinvalid_request_erroras a probe format issue → keep the modelfilterBySubscriptionAccess()in try/catch inmodel-discovery.service.tsso probe failures don't nuke the entire model listTests
permission_error(403) for genuine tier restrictionsinvalid_request_errorkeeps models (the core bug scenario)permission_errorcorrectly removes modelsFiles Changed
packages/backend/src/model-discovery/anthropic-subscription-probe.tspackages/backend/src/model-discovery/model-discovery.service.tspackages/backend/src/model-discovery/anthropic-subscription-probe.spec.tsSummary by cubic
Fixes Anthropic subscription probing so Claude.ai subscription tokens no longer hide accessible sonnet and opus models in the picker. The probe now reads error types and only filters on real permission/auth errors;
invalid_request_errorkeeps the model.authentication_error,permission_error, ornot_found_error(incl. 403).invalid_request_errorand unparseable bodies as non-blocking; default to keep models.filterBySubscriptionAccess()inmodel-discovery.service.tswith try/catch to avoid dropping all models on probe failure.invalid_request_error, removed-on-permission_error, and kept-on-bad-JSON scenarios.Written for commit e532869. Summary will update on new commits.