Repository navigation
Single tool registry as the source of truth for agent tool name lists - #1336
Conversation
…oses #1326) Agent tool names were hand-maintained in four places kept in sync only by drift-detector tests: all_tool_definitions() + BASELINE_TOOLS (tools.rs), humanize_tool_name() (agent_loop.rs), and per-skill tool_whitelist arrays (skill_pipeline.rs). Introduce a `Tool` enum in tools.rs as the canonical set. Derived from it: - all_tool_definitions() maps over Tool::ALL - humanize_tool_name() delegates to Tool::humanized() - baseline membership comes from Tool::is_baseline() - execute() dispatches via Tool::from_name() then an exhaustive match, so the compiler forces an exec arm for every registered tool Adding a tool is now one variant plus filling exhaustive match arms. Remove drift-detector tests that only existed to keep the lists aligned (humanize_tool_name_covers_all_registered_tools and the 8 per-skill whitelist assertions); their guarantee now holds by construction. Replace them with all_skill_whitelist_tools_are_registered, which validates every skill tool_whitelist entry resolves against the registry, plus registry invariant tests (unique names, name round-trip, definition/name agreement, baseline set). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Code Review SummaryRecommendation: Approve. This is a clean, well-executed refactor that does exactly what issue #1326 asks: it collapses four hand-synced tool-name lists into a single Verification performed:
Acceptance Criteria
FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
Notes
|
malibio
left a comment
There was a problem hiding this comment.
Review verdict: APPROVE (posting as comment — GitHub blocks self-approval on own PR). Clean compile-time-enforced refactor that meets the issue's intent; clippy clean and all agent-crate tests pass. Two non-blocking notes in the detailed review comment above. Cleared to merge.
Reviewer noted DeleteNode was listed mid-block in humanized() while every other match (name, definition, execute) follows Tool::ALL order. Reordered to match Tool::ALL so all four exhaustive arms are visually consistent and future audits can do a single left-to-right scan. Skipped: baseline_count two-pass (negligible on 13-element slice), structural improvements re def_*/exec_* coupling (flagged as "no action required for merge" / YAGNI by reviewer). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Address-review summary Addressed 1 of 3 review items: ✅ Nit addressed: Reordered ⏭️ Nit skipped: ⏭️ Improvements skipped: Both structural observations ( Re-review decision: NO RE-REVIEW NEEDED — only a cosmetic arm-reorder with no logic change. Reviewer's recommendation was Approve on the original diff. |
…#1336) * Introduce single Tool registry as source of truth for agent tools (closes #1326) Agent tool names were hand-maintained in four places kept in sync only by drift-detector tests: all_tool_definitions() + BASELINE_TOOLS (tools.rs), humanize_tool_name() (agent_loop.rs), and per-skill tool_whitelist arrays (skill_pipeline.rs). Introduce a `Tool` enum in tools.rs as the canonical set. Derived from it: - all_tool_definitions() maps over Tool::ALL - humanize_tool_name() delegates to Tool::humanized() - baseline membership comes from Tool::is_baseline() - execute() dispatches via Tool::from_name() then an exhaustive match, so the compiler forces an exec arm for every registered tool Adding a tool is now one variant plus filling exhaustive match arms. Remove drift-detector tests that only existed to keep the lists aligned (humanize_tool_name_covers_all_registered_tools and the 8 per-skill whitelist assertions); their guarantee now holds by construction. Replace them with all_skill_whitelist_tools_are_registered, which validates every skill tool_whitelist entry resolves against the registry, plus registry invariant tests (unique names, name round-trip, definition/name agreement, baseline set). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Address review nit: align humanized() arm order with Tool::ALL Reviewer noted DeleteNode was listed mid-block in humanized() while every other match (name, definition, execute) follows Tool::ALL order. Reordered to match Tool::ALL so all four exhaustive arms are visually consistent and future audits can do a single left-to-right scan. Skipped: baseline_count two-pass (negligible on 13-element slice), structural improvements re def_*/exec_* coupling (flagged as "no action required for merge" / YAGNI by reviewer). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Closes #1326