generate: report tools declared but not referenced by any agent - #85
generate: report tools declared but not referenced by any agent#85LuisMend12 wants to merge 1 commit into
Conversation
Generator.generate() only looked at tool_ids collected from walking the graph, so a tool declared under the top-level tools: registry but never added to any agent's tools list was invisible in the output -- no stub (correct, since nothing uses it) but also no mention. Added SystemSpec.declared_tools, populated from the full tools: registry during parsing, and diff it against the referenced tool_ids in Generator.generate() to report the difference as GenerateResult.ignored. agentctl's generate command surfaces it as: ignore <tool_id> (declared but not referenced by any agent) Fixes extra-org#67
|
Thanks for the contribution — the implementation direction is correct, and preserving the full top-level tool registry as However, PR #74 is already open for the same issue and implements the same behavior, including the PR #74 also handles the ignored-only CLI case more accurately. In this PR, the command can currently print: That summary is misleading because the ignored tool's stub does not exist by design. PR #74 uses a more accurate summary and includes an end-to-end CLI regression test. To avoid maintaining and merging two competing implementations for #67, I think we should continue with #74 and close this PR as a duplicate. The Thank you again for taking the time to work on this. |
|
Totally agree, thanks for checking — didn't see #74 was already in flight. The ignored-only summary bug you caught there is a good catch, glad it's covered. Appreciate you calling out the |
Summary
Generator.generate()only looked attool_idscollected by walking the agent graph (_collect()), so a tool declared in the top-leveltools:registry but never added to any agent'stools:list was invisible inagentctl generateoutput — no stub (correct, nothing uses it) but no mention either. A forgotten reference looked identical to an intentional one.SystemSpec.declared_tools, populated from the full top-leveltools:registry during YAML parsing (previously this registry was only used transiently inside the parser to resolve per-agent tool references, then discarded).Generator.generate()now diffsdeclared_toolsagainst the referencedtool_idsand reports the difference on a newGenerateResult.ignoredfield.agentctl generatesurfaces it:Fixes #67
Test plan
tests/parsers/test_declared_tools.py— confirms the parser populatesSystemSpec.declared_tools(ids + descriptions) from real YAML, using the exact repro from the issuetests/generate/test_plugins_manifest.py—Generator.generate()reports an unreferenced declared tool inresult.ignored(and not increated/no stub file), and reports nothing when all declared tools are referencedtests/parsers,tests/generate,tests/core— all pass except 5 pre-existing failures unrelated to this change (a Windows-only path-separator assertion bug:result.created.count("plugins/plugins.toml")compares a forward-slash literal againststr(Path.relative_to(...)), which yields backslashes on Windows — reproduces identically onmainbefore this change)