Skip to content

fix(delegate-task): honor user model override in category-resolver cold cache (fixes #2712)#2892

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/subagent-model-config-ignored
Mar 27, 2026
Merged

fix(delegate-task): honor user model override in category-resolver cold cache (fixes #2712)#2892
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/subagent-model-config-ignored

Conversation

@MoerAI
Copy link
Copy Markdown
Contributor

@MoerAI MoerAI commented Mar 27, 2026

Summary

  • Fix category-resolver to honor user-configured model when provider cache is cold

Problem

The partial fix in commit a8ec927 addressed the cold-cache model override issue in subagent-resolver.ts but not in category-resolver.ts. When using category parameter (e.g., task(category="quick")), the model resolution goes through category-resolver.ts which still ignores the user override when resolveModelForDelegateTask() returns { skipped: true } (cold cache).

This causes:

  1. User-configured category model is ignored on first run (cold cache)
  2. Falls through with categoryModel = undefined
  3. May use wrong provider/model or fail entirely

Fix

Added cold-cache user override handling in category-resolver.ts that mirrors the existing fix in subagent-resolver.ts. When resolution is skipped (cold cache) but the user has explicitly configured a model (explicitCategoryModel or overrideModel), the user override is applied directly instead of falling through.

Changes

File Change
src/tools/delegate-task/category-resolver.ts Add user model override handling when resolution returns { skipped: true }

Fixes #2712


Summary by cubic

Honor user model overrides in category-resolver when the provider cache is cold. If resolution is skipped, we apply the explicit or override model (with the right variant), matching subagent-resolver and preventing wrong model selection on first run (fixes #2712).

Written for commit 5d5eb46. Summary will update on new commits.

@MoerAI
Copy link
Copy Markdown
Contributor Author

MoerAI commented Mar 27, 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: 5d5eb46f19

ℹ️ 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 +136 to +137
const userModelOverride = explicitCategoryModel ?? overrideModel
if (userModelOverride) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Move cold-cache override logic out of unreachable branch

This new block never executes for real overrides: resolveModelForDelegateTask() returns { model: userModel } before it can return { skipped: true }, so when explicitCategoryModel ?? overrideModel is non-empty, control cannot reach this "skipped" branch. That means the intended cold-cache override fix is effectively a no-op for valid user overrides, and the behavior you intended to change remains unchanged.

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.

1 issue found across 1 file

Confidence score: 3/5

  • There is a concrete medium-severity risk (6/10, high confidence 9/10) in src/tools/delegate-task/category-resolver.ts, so this is not a no-risk merge.
  • The cold-cache override path can accept an invalid provider/model format, which may leave actualModel inconsistent while categoryModel is undefined instead of failing fast.
  • Pay close attention to src/tools/delegate-task/category-resolver.ts - cold-cache override should validate provider/model input to prevent inconsistent model resolution.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/tools/delegate-task/category-resolver.ts">

<violation number="1" location="src/tools/delegate-task/category-resolver.ts:139">
P2: Cold-cache override path does not validate invalid `provider/model` format, allowing inconsistent `actualModel` + undefined `categoryModel` to pass without error.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const userModelOverride = explicitCategoryModel ?? overrideModel
if (userModelOverride) {
actualModel = userModelOverride
const parsedModel = parseModelString(actualModel)
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 27, 2026

Choose a reason for hiding this comment

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

P2: Cold-cache override path does not validate invalid provider/model format, allowing inconsistent actualModel + undefined categoryModel to pass without error.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/tools/delegate-task/category-resolver.ts, line 139:

<comment>Cold-cache override path does not validate invalid `provider/model` format, allowing inconsistent `actualModel` + undefined `categoryModel` to pass without error.</comment>

<file context>
@@ -133,6 +133,16 @@ Available categories: ${allCategoryNames}`,
+      const userModelOverride = explicitCategoryModel ?? overrideModel
+      if (userModelOverride) {
+        actualModel = userModelOverride
+        const parsedModel = parseModelString(actualModel)
+        const variantToUse = userCategories?.[args.category!]?.variant ?? resolved.config.variant
+        categoryModel = parsedModel
</file context>
Fix with Cubic

Copy link
Copy Markdown
Owner

@code-yeongyu code-yeongyu left a comment

Choose a reason for hiding this comment

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

Correct fix for the category-resolver cold-cache gap. The partial fix in subagent-resolver.ts left category-resolver.ts unhandled — when resolution.skipped === true, the user model override should still apply. The logic mirrors what subagent-resolver already does. LGTM.

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]: Subagent model configuration ignored in v3.12.x - falls back to hardcoded fallback chain

2 participants