Skip to content

[Bug]: 技能已经激活,但绑定的工具没有权限 #2169

Open

Description

@maojiang
Image
private void skillGroup(Toolkit toolkit, String skillName, Object toolInstance) {
    toolkit.createSkillToolGroup(
            skillName + "_tools",
            "Tools for " + skillName,
            false,
            skillName);
    toolkit.registration().tool(toolInstance).group(skillName + "_tools").apply();
}
Image

Image 可能明确已经激活。

部分关键日志:

1783922769860.txt

Activity

  1. added
    bug
    on Jul 13, 2026
  2. jujn commented on Jul 13, 2026

    @jujn
    Collaborator

    这里的 toolkit 是原始的,还是通过 agent.getToolkit() 拿到的?因为 Agent 在 build 时做了深拷贝,在原始 toolkit 上更新,agent 是看不到的

  3. added
    area/core/tool
    on Jul 13, 2026
  4. maojiang commented on Jul 14, 2026

    @maojiang
    Author

    toolkit 这是每次问答build出来的agent.这个bug是偶发性的,并不是一直这样

  5. oss-maintainer commented on Jul 14, 2026

    @oss-maintainer
  6. zhgyapeng commented on Jul 19, 2026

    @zhgyapeng

    我这边也遇到了类似的问题,从compact上下文可以看到,我这边reset_equipped_tools之后,llm执行tool call还是提示了unauthorized tool调用。

    [ASSISTANT]:[tool_call]: reset_equipped_tools( {"to_activate": [  "fa-business-rules_local_skills_skill_tools" ]}
    [TOOL]: [tool_result: reset_equipped_tools]  The currently activated tool group(s): fa-business-rules_local_skills_skill_tools. <tool-instructions><group name="fa-business-rules_local_skills_skill_tools">FA工具**IMPORTANT: This tool group MUST be activated whenever the skill 'fa-business-rules' is in use.**</group></tool-instructions>
    [ASSISTANT]:[tool_call: fa_delay_handle(xxx)]
    [TOOL]: [tool_result: fa_delay_handle] Error: Unauthorized tool call: 'fa_delay_handle' is not available

    对于2.0的agentscope,agent维度的Toolkit是全局不变的,为什么groupManager中判断isActiveTool方法中内部isActiveGroup没有结合AgentState中的io.agentscope.core.state.ToolContextState#activatedGroups来进行判断?这是无状态改造的遗漏吗?

  7. YingchaoX commented on Jul 21, 2026

    @YingchaoX

    I reproduced this on the current main branch. Tool schema resolution uses the call-scoped ToolContextState.activatedGroups, while ToolExecutor authorization still reads the shared ToolGroupManager activation flags. This allows a tool to be visible to one session but rejected as unauthorized after another session changes the shared activation state.
    I’d like to submit a focused fix that makes execution authorization use the call-scoped active groups from RuntimeContext, while preserving the existing shared-state fallback for direct Toolkit.callTool() usage. I’ll also add regression tests covering conflicting session/shared activation states.

  8. moved this from Backlog to In progress in AgentScope Javaon Jul 21, 2026
  9. added a commit that references this issue on Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/core/toolbug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions