Skip to content

fix(delegate-task): trust user-configured category models without fuzzy validation (fixes #2740)#2772

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/custom-model-resolution
Mar 24, 2026
Merged

fix(delegate-task): trust user-configured category models without fuzzy validation (fixes #2740)#2772
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/custom-model-resolution

Conversation

@MoerAI
Copy link
Copy Markdown
Contributor

@MoerAI MoerAI commented Mar 23, 2026

Summary

  • User-configured category models from custom providers are now trusted without fuzzy matching against the available models set

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 calls fuzzyMatchModel() against the available models set. Custom provider models not in the official model list return null, 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

  1. Added isUserConfiguredCategoryModel flag to resolveModelForDelegateTask() input
  2. When the flag is true, the category model is returned directly without fuzzy matching (same pattern as userModel)
  3. resolveCategoryConfig() now returns isUserConfiguredModel based on whether the user explicitly set a model for the category
  4. resolveCategoryExecution() passes this flag through to the model resolution call

Changes

File Change
src/tools/delegate-task/model-selection.ts Add isUserConfiguredCategoryModel flag and early return before fuzzy matching
src/tools/delegate-task/categories.ts Return isUserConfiguredModel from resolveCategoryConfig()
src/tools/delegate-task/category-resolver.ts Pass the user-config flag through to resolveModelForDelegateTask()
src/tools/delegate-task/model-selection.test.ts Add test for custom provider model bypass

Fixes #2740


Summary by cubic

Trust user-configured category models from custom providers and bypass fuzzy validation to prevent silent fallbacks to defaults. Fixes #2740.

  • Bug Fixes
    • If a category model is explicitly set in oh-my-opencode.json, it’s used as-is (no fuzzy match).
    • Added isUserConfiguredCategoryModel flag and wired it through model resolution.
    • resolveCategoryConfig() marks user-set models; category-resolver passes the flag; tests added for the bypass.

Written for commit c41d6fd. Summary will update on new commits.

@MoerAI
Copy link
Copy Markdown
Contributor Author

MoerAI commented Mar 23, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 110 to +113
userModel: explicitCategoryModel ?? overrideModel,
userFallbackModels: normalizedConfiguredFallbackModels,
categoryDefaultModel: resolved.model,
isUserConfiguredCategoryModel: resolved.isUserConfiguredModel,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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 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.

@code-yeongyu code-yeongyu merged commit f854246 into code-yeongyu:dev Mar 24, 2026
8 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.

[Bug]: Custom model configuration in oh-my-opencode.json is ignored when model name does not match hardcoded official model list

2 participants