Skip to content

[Bug]: agents.sisyphus-junior.model configuration is ignored - model resolution priority issue #1295

@DevSissi

Description

@DevSissi

Prerequisites

  • I will write this issue in English (see our Language Policy)
  • I have searched existing issues to avoid duplicates
  • I am using the latest version of oh-my-opencode
  • I have read the documentation

Bug Description

The agents.sisyphus-junior.model configuration in oh-my-opencode.json is completely ignored. Despite the schema correctly defining sisyphus-junior as a configurable agent, and the code appearing to read the configuration, the actual model used at runtime does not respect the user's configuration.

Analysis using oh-my-opencode codebase:

After analyzing the source code, I found the root cause:

  1. Schema layer ✅ - sisyphus-junior is correctly defined in AgentOverridesSchema
  2. Agent registration ✅ - createSisyphusJuniorAgentWithOverrides() reads the config correctly
  3. Runtime invocation ❌ - When called via delegate_task(category="xxx"), the model resolution logic bypasses the agent config

The problem is in delegate-task/tools.ts:

if (args.category) {
  const resolution = resolveModelWithFallback({
    userModel: userCategories?.[args.category]?.model,  // Priority 1: category model
    categoryDefaultModel: resolved.model ?? sisyphusJuniorModel,  // Priority 3: sisyphusJuniorModel is just fallback!
    fallbackChain: requirement.fallbackChain,  // Priority 2: hardcoded fallbackChain
    availableModels,
    systemDefaultModel,
  })
  agentToUse = SISYPHUS_JUNIOR_AGENT  // Uses sisyphus-junior agent
  categoryModel = ...  // But model comes from category resolution, not agent config!
}

Model resolution priority (current - problematic):

  1. userCategories?.[category]?.model - category's model config
  2. requirement.fallbackChain - hardcoded fallback chain
  3. sisyphusJuniorModel - user's agents.sisyphus-junior.model config (lowest priority!)
  4. systemDefaultModel

This means agents.sisyphus-junior.model is effectively useless because it has the lowest priority.

Related issues:

Important finding from #1264:
Issue #1264 reveals that even configuring categories.*.model doesn't work because uiSelectedModel (main session model) has the HIGHEST priority and overrides ALL agent/category model configurations.

This means both workarounds are blocked:

  • agents.sisyphus-junior.model → bypassed by category resolution
  • categories.*.model → overridden by uiSelectedModel

Steps to Reproduce

  1. Configure oh-my-opencode.json:
{
  "agents": {
    "sisyphus-junior": {
      "model": "anthropic/claude-sonnet-4-5"
    }
  }
}
  1. Start OpenCode with a different main model (e.g., claude-opus-4-5)

  2. Trigger a category-based delegation:

delegate_task(category="quick", load_skills=[], prompt="...", run_in_background=false)
  1. Observe that sisyphus-junior does NOT use anthropic/claude-sonnet-4-5

Expected Behavior

When agents.sisyphus-junior.model is configured, the Sisyphus-Junior agent should use that model regardless of:

  • Which category is used to spawn it
  • What the main session's model is

User-defined agent model configuration should have the HIGHEST priority.

Actual Behavior

The agents.sisyphus-junior.model configuration is ignored. The model is determined by:

  1. Main session's model (uiSelectedModel) - if [Bug]: delegate_task with category parameter fails with "JSON Parse error: Unexpected EOF" - categories config ignored #1264's analysis is correct
  2. Category's fallback chain
  3. Category's default model

User's explicit agent configuration is never applied.

Doctor Output

# bunx oh-my-opencode doctor failed with workspace dependency error
# OpenCode version: 1.1.45
# oh-my-opencode version: latest (3.1.9)

Error Logs

No explicit error - the configuration is silently ignored.

Configuration

{
  "$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
  "agents": {
    "sisyphus-junior": {
      "model": "anthropic/claude-sonnet-4-5"
    }
  }
}

Additional Context

Summary of related issues:

Issue Status Problem Fixed?
#766 CLOSED Sisyphus-Junior ignores config, uses Anthropic ❌ Comments say bug persists
#826 CLOSED Cannot override model for background tasks ❌ Comments say bug persists in beta 11
#1264 OPEN uiSelectedModel overrides ALL agent configs

Root cause analysis from #766 comments (by @kassieclaire):

"override configuration from oh-my-opencode.json is being passed through the direct agent override path (via createSisyphusJuniorAgentWithOverrides) rather than through the category-based path"

Suggested fix:

In resolveModelWithFallback(), the priority should be:

// 1. User's explicit agent config (HIGHEST)
if (normalizedUserModel) {
  return { model: normalizedUserModel, source: "override" };
}
// 2. Category config
// 3. Fallback chain
// 4. System default (LOWEST)

Or better: remove uiSelectedModel from subagent model resolution entirely - it should only apply to the main session.

Operating System

Windows

OpenCode Version

1.1.45

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions