fix(delegate-task): trust user-configured category models without fuzzy validation (fixes #2740)#2772
Conversation
…zy validation (fixes code-yeongyu#2740)
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c41d6fd912
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| userModel: explicitCategoryModel ?? overrideModel, | ||
| userFallbackModels: normalizedConfiguredFallbackModels, | ||
| categoryDefaultModel: resolved.model, | ||
| isUserConfiguredCategoryModel: resolved.isUserConfiguredModel, |
There was a problem hiding this comment.
Route category overrides through the new bypass path
In the task category flow, the same categories.<name>.model value is still passed as userModel on the previous line, while resolved.isUserConfiguredModel is derived from that same field in categories.ts. Because resolveModelForDelegateTask() returns immediately whenever userModel is set, the new isUserConfiguredCategoryModel branch never executes for real user-configured category models. In practice this means the change does not alter production behavior for the #2740 scenario, even though the new unit test passes by calling resolveModelForDelegateTask() directly with a shape that resolveCategoryExecution() never uses.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes model resolution for custom providers by trusting explicit user configuration, following existing patterns for agent models with no impact on default behavior.
Summary
Problem
When users configure custom models for categories in oh-my-opencode.json (e.g.,
"writing": { "model": "new-api-openai/gpt-5.4-high" }), the model resolution pipeline callsfuzzyMatchModel()against the available models set. Custom provider models not in the official model list returnnull, causing the system to silently fall back to a default model the user never configured.Per-agent model overrides (
agents.{name}.model) already bypass this validation and work correctly. This PR applies the same treatment to user-configured category models.Fix
isUserConfiguredCategoryModelflag toresolveModelForDelegateTask()inputuserModel)resolveCategoryConfig()now returnsisUserConfiguredModelbased on whether the user explicitly set a model for the categoryresolveCategoryExecution()passes this flag through to the model resolution callChanges
src/tools/delegate-task/model-selection.tsisUserConfiguredCategoryModelflag and early return before fuzzy matchingsrc/tools/delegate-task/categories.tsisUserConfiguredModelfromresolveCategoryConfig()src/tools/delegate-task/category-resolver.tsresolveModelForDelegateTask()src/tools/delegate-task/model-selection.test.tsFixes #2740
Summary by cubic
Trust user-configured category models from custom providers and bypass fuzzy validation to prevent silent fallbacks to defaults. Fixes #2740.
oh-my-opencode.json, it’s used as-is (no fuzzy match).isUserConfiguredCategoryModelflag and wired it through model resolution.resolveCategoryConfig()marks user-set models;category-resolverpasses the flag; tests added for the bypass.Written for commit c41d6fd. Summary will update on new commits.