Skip to content

fix: keep the last duplicate tool in a registration batch - #477

Merged
punkpeye merged 1 commit into
punkpeye:mainfrom
remote-controlled-man:codex/prflow-1f4e738aeba6
Oct 27, 2026
Merged

punkpeye merged 1 commit into
punkpeye:mainfrom
remote-controlled-man:codex/prflow-1f4e738aeba6

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

When addTools() receives multiple definitions with the same name, tools/list advertises all of them while tools/call executes only the last. Clients can therefore see an obsolete input or output schema for the tool they actually call.

Keep the last definition of each name, in the same order as sequential addTool() calls. Check every tool's Standard Schema interfaces before changing registrations and retain one list-change notification per batch.

Regression coverage uses an SDK client over InMemoryTransport. It checks duplicate names before and after connection, replacement of an existing tool, the advertised schemas and actual calls, unaffected tools, notification counts, and atomic rejection of unsupported Standard Schema interfaces on inputs and outputs. Both duplicate-name cases fail on the unmodified implementation.

Validation on macOS with Node 24 and pnpm 9:

  • pnpm test: 81 files, 1,262 tests passed.
  • pnpm lint: passed, including the JSR publish dry-run.
  • pnpm build: passed.
  • pnpm test:openapi: both files and all 15 benchmark/live tests passed.

Prepared with AI assistance (OpenAI Codex).

Copilot AI balanced review requested due to automatic review settings October 27, 2026 02:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@punkpeye
punkpeye merged commit 846e479 into punkpeye:main Oct 27, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.23.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants