Repository navigation
Make tool an abstract base with a tool-native subtype and drop source (closes #3450) - #3496
Conversation
Pragmatic Code Review — PR #3496Review Type: Initial Review (no prior reviews or comments on the PR; head SummaryThe change does what the issue asks and is a clear net improvement: What I ran: Requirements Check
Reviewer rejection list: no undeclared key, no literal Code Review Findings1. 🟡 Important — The reader treats a missing Recommendation: make the default 2. 🟡 Important — the built-in-name guard covers only non-native tools; a second native node can still replace a built-in tool's definition A non-native node named Recommendation: for a handler that is in 3. 🟢 Suggestion — the native test lives in two places
4. 🟢 Suggestion — an offered non-native tool cannot be called
5. Nit — stale comments that still describe the old shape
6. Nit — docs disagree on mentionability 7. Nit — 📁 What is solid
Recommendation: APPROVENo blocker. Findings 1 and 2 are each a few lines plus a test and should be folded into this PR before merge rather than filed separately. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressed (commit 4fea0db)Addressed
Both new guards are mutation-checked: reverting either fails the new tests. Skipped
Re-review: needed — findings 1 and 2 changed the trust gate's behaviour. |
Pragmatic Code Review — PR #3496 (re-review)Review Type: Re-Review (first review on Previous Review Summary: 7 earlier findings. 5 addressed correctly (1, 2, 3, 4, 5), 2 skipped with reasons that hold (6, 7), 0 addressed incorrectly. No new Critical or Important issue; 6 new Suggestions/Nits, none blocking. What I ran on Status of each earlier finding
New findings1. 🟢 Suggestion — 2. 🟢 Suggestion — the new core assertion does not use the value it just read 3. 🟢 Suggestion — two tools that are not native can share a name, and the later one wins 4. 🟢 Suggestion (suspicion, not introduced here) — the 256-node page is shared with nodes that are now always skipped 5. Nit — log wording and level 6. Nit — docs ( Recommendation: APPROVEBoth Important findings are fixed, tested through the real write path, and documented. The new items are optional polish; 1 and 2 are a few lines each if you want them in this PR. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Re-review addressed (commit fe581ef)Addressed
Skipped
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: this commit removes an unused function, tightens one test assertion and rewords two log lines. No logic the gate depends on changed. |
…closes #3450) tool is now abstract (ADR-086 §12): it declares description, parameter_schema and enabled, and is never instantiated. tool-native is a new core subtype that declares handler; the seeded built-in tools are tool-native nodes. The source field is gone: the subtype says where a tool comes from. The trust gate is behaviors::tool_is_offered, decided from the node's extends chain: a native tool is always offered, any other tool subtype only when enabled. available_tools() queries every tool subtype, applies the gate, and refuses a non-native tool that takes a built-in tool's name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ool only from its seed - enabled defaults to false, so a tool that is not native and never says whether it is enabled is stored as off and not offered (fail closed). - available_tools() admits a built-in tool only from its own seeded node: a native node naming a built-in handler without being that tool's seed, a native node whose handler is no built-in tool, and any other subtype taking a built-in tool's name are skipped, so none can replace a built-in tool's description and schema. - ToolOrigin in core decides both the gate and what a tool is called by, replacing two separate chain tests in the agent. - Stale comments describing node_type='tool' and the source field fixed. Skipped: the seed content wording for a tool-native placeholder (no +New path creates a tool). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…te test - tool_is_offered had no production caller once the agent moved to ToolOrigin; deleted, with its tests pointed at ToolOrigin. - The stored-default assertion now passes the value it read to the gate. - Log lines say what was actually skipped. Skipped: two tools that are not native sharing a name (nothing dispatches one yet; settled with remote bindings), and reading seeds by id instead of through the 256-node page (not reachable with the built-in set). Co-Authored-By: Claude Opus 5.5 <[email protected]>
fe581ef to
28e36ca
Compare
Closes #3450. Implements ADR-086 §12.
What changes
Kind and category.
toolbecomes an abstract base (structured:parameter_schemais an object).tool-nativeis a new core subtype of it (structured through the inherited field). Both keep the generic wire shapetoolalready had.tool(abstract)description,parameter_schema,enabled(buckettool)parameter_schemadepth ≤ 9 and no openadditionalProperties; no children; embedded as name + descriptiontool-nativehandler(buckettool-native)handlerrequired; always trustedsourceis deleted. The subtype says where a tool comes from. Thetoolbucket is closed, so a write that namessourceis refused.behaviors::tool_is_offered(chain, enabled): a type that istool-nativeor extends it is always offered; any other type extendingtoolis offered only whenenabled. A subtype nobody has given a rule is therefore untrusted.available_tools()queriestool(every subtype), resolves each subtype's chain once, applies the gate, and reads the collapsed wire fields. A native tool is called by itshandlerkey; any other subtype by its name. A non-native tool that takes a built-in tool's name is skipped, so it can't put its own description and schema in that tool's place.tool-nativenodes. No relationships, structural rules or participation rules change: the leaf rule and embedding stay declared ontooland reach the subtype through the chain.isA) instead of an exact id match, so it reachestool-native.No remote subtype (
tool-mcp,tool-rest,tool-cli) is added.Tests
packages/core/tests/it/tool_subtypes_test.rs: a baretoolis refused on every create path and on retype; bucket placement; closed buckets (sourcerefused); the base's schema guard and leaf rule reach a fixture subtype that extendstool; atoolquery returns every subtype.available_toolstests run against the real seeding path, with a fixture remote-style subtype: offered only whenenabled, never under a built-in name; seeded native tools produce the registry's definitions in order.truefor non-native tools, and removing the built-in-name guard, each fail the gate tests.bun run test:changedpasses (frontend, scripts, browser, types drift, Rust workspace).Docs
components/node-types.mdandcomponents/tool-registry.mdin nodespace-docs already describe this shape; the tool registry page gains where the gate lives and what a tool is called by (nodespace-docs8ee39e3).architecture/prompt-skill-system.mdneeded no change: it defers to the tool registry page for tool nodes and the trust gate.🤖 Generated with Claude Code