Skip to content

fix(delegate-task): only check resolved model for isUnstableAgent, not category default#2507

Merged
acamq merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/issue-2287-unstable-agent-check
Mar 15, 2026
Merged

fix(delegate-task): only check resolved model for isUnstableAgent, not category default#2507
acamq merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/issue-2287-unstable-agent-check

Conversation

@MoerAI
Copy link
Copy Markdown
Contributor

@MoerAI MoerAI commented Mar 12, 2026

Summary

Closes #2287

The isUnstableAgent check in category-resolver.ts was checking both the resolved model (actualModel) and the category's default model (resolved.config.model). This meant that even when a user overrides visual-engineering or writing to use a stable model like anthropic/claude-sonnet-4-6, the default model name (google/gemini-3.1-pro or kimi-for-coding/k2p5) still triggered isUnstableAgent = true.

This routed tasks through executeUnstableAgentTask() instead of the stable execution path, causing a race condition where manager.getTask(task.id) returns undefined after the task completes before the polling loop catches it, resulting in "Task not found" errors.

Changes

  • src/tools/delegate-task/category-resolver.ts — Only check the resolved/actual model for unstable agent detection, not the category's hardcoded default model

Before

const unstableModel = actualModel?.toLowerCase()
const categoryConfigModel = resolved.config.model?.toLowerCase()
const isUnstableAgent = resolved.config.is_unstable_agent === true 
  || [unstableModel, categoryConfigModel].some(m => ...)

After

const resolvedModel = actualModel?.toLowerCase()
const isUnstableAgent = resolved.config.is_unstable_agent === true 
  || (resolvedModel ? resolvedModel.includes("gemini") || ... : false)

Impact

Category Default Model User Override Before After
visual-engineering gemini-3.1-pro claude-sonnet-4-6 isUnstable=true (CRASH) isUnstable=false (OK)
writing kimi-k2p5 claude-sonnet-4-6 isUnstable=true (CRASH) isUnstable=false (OK)
visual-engineering gemini-3.1-pro (none) isUnstable=true isUnstable=true (unchanged)

Summary by cubic

Fixes unstable-agent detection to consider only the resolved model, so stable overrides use the stable execution path. Resolves #2287 by removing misroutes that caused intermittent "Task not found" errors.

  • Bug Fixes
    • Updated src/tools/delegate-task/category-resolver.ts to check only the resolved model in isUnstableAgent, not the category default.
    • Behavior is unchanged when no override is provided and the category’s default model is unstable.

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

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 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Correctly ensures that model overrides use the appropriate execution path by checking the resolved model's stability rather than the category default. High confidence in no regressions.

@acamq
Copy link
Copy Markdown
Collaborator

acamq commented Mar 15, 2026

Thank you!

@acamq acamq merged commit f248c73 into code-yeongyu:dev Mar 15, 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.

visual-engineering and writing categories crash with "Task not found" due to isUnstableAgent model name check

2 participants