Repository navigation
fix(model): return clear error instead of silent openai default for unrecognized models #2492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,17 @@ export async function resolveModelOrError( | |
| } | ||
|
|
||
| if (!modelInfo.provider) { | ||
| // model_not_found: raised by resolveModelByProviderInference when no | ||
| // provider could be inferred — return a clear error instead of the | ||
| // misleading "openai" default that the old code silently fell back to. | ||
| if ((modelInfo as any).errorType === "model_not_found") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of |
||
| const message = | ||
| (modelInfo as any).errorMessage || | ||
| `Model '${modelStr}' could not be resolved to a known provider.`; | ||
| log.warn("CHAT", message, { model: modelStr }); | ||
| return { error: errorResponse(HTTP_STATUS.BAD_REQUEST, message) }; | ||
| } | ||
|
|
||
| if ((modelInfo as any).errorType === "ambiguous_model") { | ||
| // Family disambiguation: if the model name begins with a known | ||
| // non-OAuth family prefix, auto-pick the family-native provider | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository style guide (Rule 9) requires that all changes to production code in
open-sse/include tests. Please add unit tests (e.g., intests/unit/services/model.test.ts) to verify thatresolveModelByProviderInferencecorrectly returns themodel_not_founderror object when no provider can be inferred, ensuring this new logic is covered and preventing regressions.References