nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Scoped skill-bundle tools are offered to the main conversation although they are hidden from the tool list

Open addyCooks opened this issue 2 weeks ago • 1 comments

Description

Bundle tools default to tools_visibility: scoped: they should be visible only to the bundle's own subagent. getAllTools() hides them, but getAvailableToolNames() (the list that decides which tools may run) still includes them, and the handler can be looked up. The main conversation can run one if the model names it.

Environment

  • OS: Windows 11 Home 10.0.26300
  • Node version: v22.22.3
  • Nanocoder version: 1.32.0 (built from main at 5df35b3a)
  • Provider: Not provider-specific
  • Model: Not model-specific

Steps to Reproduce

  1. Create const tm = new ToolManager().
  2. Register a scoped tool: tm.registerSkillTool({name: 'secret_tool', tool: {description: 'x'}, handler: async () => 'RAN', approval: false, readOnly: true, ownerSkill: 'k8s', scoped: true}).
  3. Check tm.getAvailableToolNames(undefined, 'normal', []).includes('secret_tool'), 'secret_tool' in tm.getAllTools() and !!tm.getToolHandler('secret_tool').

Expected Behavior

The tool is not available to the main conversation (false).

Actual Behavior

getAvailableToolNames includes it: true
getAllTools has it:               false
handler resolvable:               true

The check in tool-filters.ts (hasTool) then passes.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs with the latest version of nanocoder (main)

Suggested fix:

  • source/tools/tool-manager.ts:455 (getAvailableToolNames): drop scoped entries unless the caller is the owning skill's subagent (entry.scoped is already checked at line 571).
  • Check source/hooks/chat-handler/utils/tool-filters.ts:90 and source/skills/registrar.ts:123.
  • Add a test that a scoped tool is not in the main-agent list and still works for its subagent.

addyCooks avatar Nov 16 '26 09:11 addyCooks

I'm picking this up. Plan: drop scoped entries from getAvailableToolNames() unless the caller is the owning skill's subagent, check the other two call sites you listed, and add a test that a scoped tool is unavailable to the main conversation and still runs for its subagent.

PloneMraz avatar Nov 17 '26 03:11 PloneMraz