Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

  • Understand the issue: Function tools are duplicated when plugins are reloaded
  • Fix the _unbind_plugin method to remove function tools associated with the plugin
  • Handle both bound tools (via handler_module_path) and unbound tools (via handler.module)
  • Verify the fix by checking related code paths (reload, uninstall, turn_off_plugin)
  • Run linting and formatting checks
  • Address code review feedback about tools without handler_module_path set
  • Refactor to use list comprehension pattern consistent with rest of codebase
  • Run CodeQL security check - passed with no alerts
  • Optimize to single-pass iteration to avoid duplicate evaluations
  • Improve docstring clarity about bound vs unbound tools
  • Resolve merge conflict with master branch - kept more robust implementation
Original prompt

#3218
修复这个bug


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@LIghtJUNction LIghtJUNction requested a review from Copilot November 1, 2025 18:03
@LIghtJUNction LIghtJUNction marked this pull request as ready for review November 1, 2025 18:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to remove function calling tools (LLM tools) registered by a plugin when the plugin is unbound/uninstalled. Previously, when a plugin was uninstalled, its handlers were removed but the LLM function tools it registered remained in the global llm_tools.func_list, causing potential issues.

  • Adds cleanup logic to remove function calling tools when unbinding a plugin
  • Filters tools by matching handler_module_path with the plugin's module path
  • Excludes MCP-origin tools from removal

Copilot AI changed the title [WIP] Fix bug described in issue 3218 Fix function tool duplication on plugin reload Nov 1, 2025
Copilot AI requested a review from LIghtJUNction November 1, 2025 18:10
Copilot finished work on behalf of LIghtJUNction November 1, 2025 18:10
@LIghtJUNction
Copy link
Member

@copilot 有没有新增函数

Copy link
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot 有没有新增函数

没有新增公开函数。只在 _unbind_plugin 方法内部添加了一个私有的辅助函数 _should_remove_tool 用于判断工具是否属于当前插件。这是一个内部实现细节,不影响外部 API。

(No new public functions added. Only added a private helper function _should_remove_tool inside the _unbind_plugin method to check if a tool belongs to the current plugin. This is an internal implementation detail that doesn't affect the external API.)

Copilot finished work on behalf of LIghtJUNction November 2, 2025 06:15
@LIghtJUNction
Copy link
Member

@copilot 解决冲突

Copy link
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot 解决冲突

冲突已解决,已合并 master 分支。保留了我们更完善的实现(双重匹配策略、单次遍历、MCP 工具过滤),这比 master 分支的实现更健壮。合并提交:6ebea8d

(Conflict resolved, master branch merged. Kept our more robust implementation with dual matching strategy, single-pass iteration, and MCP tool filtering. Merge commit: 6ebea8d)

Copilot finished work on behalf of LIghtJUNction November 2, 2025 11:03
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.

2 participants