Skip to content

Calling use_skill tool switches agent to default_agent unexpectedly #9067

Closed

Description

@fancydirty

Description

Problem
When any agent calls the use_skill tool, it gets reset to the global model setting instead of keeping the agent's own configured model.

Evidence
Before use_skill:
▣ Orchestrator · claude-opus-4-5-thinking-high
After use_skill:
▣ Orchestrator · gemini-3-flash
Impact

  • Agents lose their model configuration after loading skills
  • Subagents spawned in parallel get stuck when their model changes mid-task
  • Skills become unusable for agents with custom model configurations
    Expected Behavior
    use_skill should load the skill content without changing the agent's model. Each agent should retain its configured model throughout its lifecycle.

Plugins

oh-my-opencode, oh-my-opencode-slim

OpenCode version

1.1.25

Steps to reproduce

  1. Configure global model: "google/gemini-3-flash" in opencode.json
  2. Configure an agent with a different model:
    orchestrator: {
    model: anthropic/claude-opus-4-5
    }
  3. Use that agent and call use_skill("some-skill")
  4. Observed: Agent switches to global default model (gemini-3-flash)
  5. Expected: Agent stays on its configured model (claude-opus-4-5)

Operating System

Ubuntu 22.04

Terminal

wsl

Activity

  1. github-actions commented on Jan 17, 2026

    @github-actions
    Contributor

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

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

  2. fancydirty commented on Jan 19, 2026

    @fancydirty
    Author

    修复方案

    这个问题的根本原因是在 use_skill 工具调用 client.session.prompt() 时没有传递 agent 参数,导致 OpenCode 使用默认的 agent 配置。

    问题代码

    在 superpowers.js 的 use_skill 工具中:

    await client.session.prompt({
      path: { id: context.sessionID },
      body: { noReply: true, parts: [{ type: 'text', text: skillContent, synthetic: true }] }
    });

    修复后代码

    添加 agent: context.agent 参数来保留当前 agent 的配置:

    await client.session.prompt({
      path: { id: context.sessionID },
      body: { agent: context.agent, noReply: true, parts: [{ type: 'text', text: skillContent, synthetic: true }] }
    });

    修改文件位置

    文件路径: ~/.config/opencode/plugin/superpowers.js(或项目内的 .opencode/plugin/superpowers.js)

    代码行: 约第 120 行附近

    修复原理

    context.agent 包含了当前会话的 agent 配置信息。当调用 session.prompt() 时传递这个参数,OpenCode 会使用当前的 agent 设置而不是全局默认配置。

    验证步骤

    1. 重启 OpenCode 使插件重新加载
    2. 配置一个非默认模型的 agent
    3. 调用 use_skill("some-skill")
    4. 确认 agent 模型保持不变

    相关参考

    这个修复确保 use_skill 加载 skill 内容时不会改变 agent 的模型配置。

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions