Skip to content

fix(core): allow toolkit replacement to retain tool names - #1448

Open
Jun516 wants to merge 1 commit into
VoltAgent:mainfrom
Jun516:fix/toolkit-replacement-name-conflicts
Open

Jun516 wants to merge 1 commit into
VoltAgent:mainfrom
Jun516:fix/toolkit-replacement-name-conflicts

Conversation

@Jun516

@Jun516 Jun516 commented Oct 12, 2026 •

Copy link
Copy Markdown

Replacing a toolkit with the same toolkit name and tool names returns false, leaving the old schema and implementation in use. addToolkit() checks the incoming names against the toolkit it is supposed to replace, even though its documented behavior permits replacement.

Check standalone user/provider tools and other toolkits for conflicts, excluding only the toolkit being replaced. Validate before mutating the registry so a rejected replacement preserves the existing toolkit. Include a patch changeset for @voltagent/core.

Validation:

  • Five new regressions cover same-name user/provider replacement, executing the updated user tool, other-toolkit conflicts, and standalone user/provider conflicts added after the original toolkit.
  • On unchanged main, the two replacement regressions fail (24 manager tests pass); with the fix, all 55 tests across tool construction, tool management, and UI tool parsing pass.
  • Core tsc --noEmit, a separate strict type check including the changed spec, and Biome checks for both changed TypeScript files pass.

Tests use Node 22.18.0, Vitest 3.2.4 and isolated dependencies with the affected AI SDK versions taken from the upstream lockfile. Vitest uses --configLoader runner to avoid a Windows config-bundling access error. The full monorepo build/test suite was not run.

AI assistance was used for the implementation and tests; the final change and conflict boundaries were reviewed and the real repository tests rerun.


Summary by cubic

Fixes addToolkit() so replacing a toolkit with the same name and tool names succeeds instead of returning false and leaving the old schema and implementation in use.

Conflict checks now exclude only the toolkit being replaced, while still rejecting collisions with standalone user/provider tools and other toolkits. Validation runs before the registry is mutated, so a rejected replacement preserves the existing toolkit. Five regression tests cover user and provider tool replacement plus conflict cases, and a patch changeset is added for @voltagent/core.

Written for commit dd54ddb. Summary will update on new commits.

View guided diff

Summary by CodeRabbit

  • Bug Fixes
    • Replacing a toolkit now succeeds when its tools retain the same names, including names shared with provider-defined tools.
    • Replacements are rejected if they conflict with tools from another toolkit or standalone tools. Existing toolkits remain intact when a replacement is rejected.

@changeset-bot

changeset-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dd54ddb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@voltagent/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f62fee84-161e-4ae8-b9c8-76adfd4ee7a3

📥 Commits

Reviewing files that changed from the base of the PR and between 72a46c7 and dd54ddb.


📒 Files selected for processing (3)
  • .changeset/fix-toolkit-replacement.md
  • packages/core/src/tool/manager/ToolManager.ts
  • packages/core/src/tool/manager/index.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

ToolManager.addToolkit now checks replacement tool names against base tools, provider tools, and other toolkits, excluding the toolkit being replaced. Tests cover successful same-name replacements and conflicts. A patch changeset records the update.

Changes

Toolkit replacement

Layer / File(s) Summary
Replacement conflict checks
packages/core/src/tool/manager/ToolManager.ts, .changeset/fix-toolkit-replacement.md
addToolkit checks replacement names against base tools, provider tools, and other toolkits. It excludes a toolkit with the same name from the toolkit comparison. The changeset records a patch release for @voltagent/core.
Replacement behavior tests
packages/core/src/tool/manager/index.spec.ts
Tests verify that replacements can retain names from base and provider tools. They also verify rejection when a name conflicts with another toolkit or a standalone tool. Tests check the exposed tools, mappings, lookup, schema, and execution preparation.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to dd54d

The toolkit replacement change is mergeable after normal checks; no outstanding issue is identified.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing toolkit replacement while retaining tool names.
Description check Passed The description explains the current and new behavior, conflict boundaries, validation order, tests, changeset, and verification results. It does not explicitly complete the checklist, link a related …
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant