Skip to content

agents switch does not respect the custom model with id #3015

Closed

Description

@towry

I have searched the issues, and it seems the "id" feature just landed last week.

The issue is that the /agents command switches the agent, but it does not change the model specified in the "model" field of that agent, if the model is an extended custom model with an "id" field.

If you manually select the model, the model works.

Activity

  1. changed the title [-]model switch does not respect the custom model with id[/-] [+]agents switch does not respect the custom model with id[/+] on Oct 7, 2025
  2. github-actions commented on Oct 7, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The core issue appears to be that when using custom models with extended configurations (including the 'id' field), the agent switching mechanism doesn't properly handle the model selection. Issues #2877 and #2829 were already referenced in your description and deal with the same 'id' feature that landed recently.

    Feel free to ignore if none of these address your specific case.

  3. rekram1-node commented on Oct 7, 2025

    @rekram1-node
    Contributor

    @towry hmm can you share your agent definition? So I can see how you are referencing the model?

    Perhaps your opencode.json too so I can see the model id there?

    if you run:
    opencode debug config

    it should give me both of those

  4. self-assigned this
    on Oct 7, 2025
  5. towry commented on Oct 7, 2025

    @towry
    Author
    {
      "$schema": "https://opencode.ai/config.json",
      "share": "disabled",
      "autoupdate": false,
      "disabled_providers": [
        "openai",
        "gemini"
      ],
      "model": "glm-4.6",
      "small_model": "glm-4.6",
      "agent": {
        "plan": {
          "model": "openrouter/gpt-5-codex-medium",
          "tools": {
            "write": false,
            "edit": false,
            "bash": false,
            "grep": true,
            "list": true,
            "glob": true,
            "exa-search*": true,
            "grep-code*": true
          },
          "mode": "primary"
        },
        "kick-muse": {
          "model": "glm-4.6",
          "prompt": "取并遵lse)",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true,
            "read": true,
            "glob": true,
            "grep": true,
            "list": true,
            "patch": true,
            "todowrite": true,
            "todoread": true,
            "webfetch": true,
            "playwright*": true,
            "exa-search*": true,
            "grep-code*": true
          },
          "description": "Kick start muse workflow",
          "mode": "primary",
          "permission": {
            "edit": "allow",
            "bash": "allow",
            "webfetch": "allow"
          },
          "name": "kick-muse"
        },
        "muse": {
          "model": "openrouter/gpt-5-codex-medium",
          "prompt": "角色增步骤时复制)\n\n### [Step step-<new-id> — <名称>]\n\n<按上述结构填充>\n```",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true,
            "read": true,
            "glob": true,
            "grep": true,
            "list": true,
            "webfetch": true,
            "exa-search*": true,
            "grep-code*": true
          },
          "description": "Muse",
          "mode": "primary",
          "permission": {
            "edit": "ask",
            "bash": "ask"
          },
          "name": "muse"
        },
        "sumon": {
          "model": "glm-4.6",
          "prompt": "Pleas.\n```",
          "tools": {
            "write": true,
            "edit": true,
            "bash": false,
            "read": true,
            "glob": true,
            "grep": true,
            "list": true,
            "webfetch": true
          },
          "description": "Summarize changes",
          "mode": "subagent",
          "permission": {
            "edit": "ask"
          },
          "name": "sumon"
        },
        "sage": {
          "model": "glm-4.6",
          "prompt": "作为维护。",
          "tools": {
            "write": false,
            "edit": false,
            "bash": true,
            "read": true,
            "glob": true,
            "grep": true
          },
          "description": "Research and analyze codebases",
          "mode": "subagent",
          "permission": {
            "edit": "allow",
            "bash": "allow"
          },
          "name": "sage"
        },
        "oracle": {
          "model": "openrouter/openai/gpt-5-codex",
          "prompt": "You ans.",
          "tools": {
            "write": false,
            "edit": false,
            "patch": false,
            "read": true,
            "grep": true,
            "list": true,
            "glob": true,
            "exa-search*": true,
            "grep-code*": true
          },
          "description": "\"Consult the Oracle - an AI advisor powered by OpenAI's GTP-5 reasoning model\nthat can plan, review, and provide expert guidance.\"\n",
          "mode": "subagent",
          "name": "oracle",
          "reasoningEffort": "medium",
          "reasoningSummary": "auto",
          "textVerbosity": "medium"
        },
        "designer": {
          "model": "openrouter/meta-llama/llama-4-maverick",
          "prompt": "You areents",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true,
            "read": true,
            "glob": true,
            "grep": true
          },
          "description": "Designer, converts images to Figma-compatible design data in JSONC format for webpage and UI element creation, return the generated file path",
          "mode": "subagent",
          "permission": {
            "edit": "allow",
            "bash": "allow"
          },
          "name": "designer"
        }
      },
      "provider": {
        "openrouter": {
          "name": "OpenRouter",
          "npm": "@openrouter/ai-sdk-provider",
          "models": {
            "gpt-5-codex-medium": {
              "id": "openai/gpt-5-codex",
              "name": "GPT-5 Codex Medium",
              "options": {
                "reasoningEffort": "medium",
                "textVerbosity": "low",
                "reasoningSummary": "auto"
              }
            },
            "gpt-5-medium": {
              "id": "openai/gpt-5",
              "name": "GPT-5 Medium",
              "options": {
                "reasoningEffort": "medium",
                "textVerbosity": "low",
                "reasoningSummary": "auto"
              }
            },
            "z-ai/glm-4.6": {
              "name": "GLM 4.6",
              "attachment": true,
              "tool_call": true
            },
            "deepseek/deepseek-chat-v3.1": {
              "name": "DeepSeek Chat V3.1",
              "attachment": true,
              "tool_call": true
            },
            "qwen/qwen3-max": {
              "name": "Qwen 3 Max",
              "attachment": true,
              "tool_call": true
            },
            "mistralai/mistral-small-24b-instruct-2501": {
              "name": "Mistral Small 24B Instruct"
            },
            "meta-llama/llama-4-scout": {
              "name": "Llama 4 Scout",
              "attachment": true,
              "tool_call": true
            },
            "meta-llama/llama-4-maverick": {
              "name": "Llama 4 Maverick",
              "attachment": true,
              "tool_call": true
            },
            "meta-llama/llama-3.3-70b-instruct": {
              "name": "Llama 3.3 70B Instruct",
              "tool_call": true
            },
            "z-ai/glm-4.5": {
              "name": "GLM 4.5",
              "tool_call": true
            },
            "z-ai/glm-4.5v": {
              "name": "GLM 4.5V",
              "attachment": true,
              "tool_call": true
            },
            "mistralai/mistral-medium-3.1": {
              "name": "Mistral Medium 3.1",
              "attachment": false,
              "tool_call": true
            },
            "moonshotai/kimi-vl-a3b-thinking": {
              "name": "Kimi VL A3B Thinking",
              "attachment": false,
              "tool_call": true
            },
            "google/gemini-2.5-flash-lite-preview-06-17": {
              "name": "Gemini 2.5 Flash Lite",
              "attachment": true,
              "tool_call": true
            },
            "anthropic/claude-3-haiku": {
              "name": "Claude 3 Haiku",
              "tool_call": true
            },
            "google/gemini-2.0-flash-001": {
              "name": "Gemini 2.0 Flash"
            }
          },
          "options": {
            "apiKey": "xxxxxxxxxxxxxx"
          }
        }
      },
      "mcp": {
        "commander": {
          "type": "local",
          "command": [
            "commander-mcp"
          ],
          "enabled": true
        },
        "context7": {
          "type": "local",
          "command": [
            "bunx",
            "@upstash/context7-mcp"
          ],
          "environment": {},
          "enabled": true
        },
        "playwright": {
          "type": "local",
          "command": [
            "bunx",
            "@playwright/mcp@latest"
          ],
          "enabled": false
        },
        "github-mcp-server": {
          "type": "local",
          "command": [
            "github-mcp-server",
            "stdio",
            "--toolsets",
            "all"
          ],
          "environment": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": "xxxxxxxxxx"
          },
          "enabled": false
        },
        "exa-search": {
          "type": "remote",
          "url": "https://mcp.exa.ai/mcp",
          "enabled": true,
          "headers": {
            "Authorization": "Bearer xxxxxxxxxx"
          }
        },
        "grep-code": {
          "type": "remote",
          "url": "https://mcp.grep.app",
          "enabled": false
        }
      },
      "lsp": {},
      "instructions": [
        "./AGENTS.md"
      ],
      "permission": {
        "edit": "allow",
        "bash": {
          "*": "ask",
          "git commit": "ask",
          "git add": "ask"
        },
        "webfetch": "ask"
      },
      "mode": {},
      "plugin": [
        "file:///Users/towry/.config/opencode/plugin/notify.ts"
      ],
      "command": {},
      "username": "towry"
    }
    

    I masked the api key and removed some content in the prompt.

  6. towry commented on Oct 7, 2025

    @towry
    Author
    2025-10-07.23.52.31.mov

    If i change the model of "plan" agent to model without id, the "tab" or "/agents" switch works.

  7. towry commented on Oct 7, 2025

    @towry
    Author
    /.config/opencodedirenv 🔽/😤
    ➜  opencode models | grep codex                                                                                                                         00:17:59
    openrouter/openai/gpt-5-codex
    openrouter/gpt-5-codex-medium
    
  8. rekram1-node commented on Oct 7, 2025

    @rekram1-node
    Contributor

    ah ik issue then. will need to think about solution

  9. rekram1-node commented on Oct 14, 2025

    @rekram1-node
    Contributor

    will be fixed in next release

  10. towry commented on Oct 14, 2025

    @towry
    Author

    Working great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions