Skip to content

fix: prevent unknown plugin reload from reloading all - #9556

Draft
AsahinaYui wants to merge 1 commit into
AstrBotDevs:masterfrom
AsahinaYui:fix/9546
Draft

fix: prevent unknown plugin reload from reloading all#9556
AsahinaYui wants to merge 1 commit into
AstrBotDevs:masterfrom
AsahinaYui:fix/9546

Conversation

@AsahinaYui

@AsahinaYui AsahinaYui commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • return a plugin-not-found result when an explicit plugin name cannot be resolved
  • preserve the intentional reload(None) reload-all behavior
  • add regression coverage for unknown and empty plugin names, including lifecycle and registry side effects

Root cause

PluginManager.reload used the falsiness of specified_module_path to select the reload-all path. An explicit unresolved plugin name left that value as None, so the manager terminated and unbound every registered plugin before loading all plugins again.

Impact

Reload requests for missing plugins now fail safely without terminating plugins, unbinding handlers, clearing registries, or invoking the loader.

Validation

  • uv run pytest tests/test_plugin_manager.py -k "reload_unknown_plugin" -q — 2 passed
  • uv run pytest tests/test_plugin_manager.py -k "reload" -q — 12 passed
  • uv run pytest tests/test_plugin_manager.py -q — 64 passed
  • uv run ruff format --check astrbot/core/star/star_manager.py tests/test_plugin_manager.py
  • uv run ruff check astrbot/core/star/star_manager.py tests/test_plugin_manager.py
  • git diff --check

Fixes #9546

Summary by Sourcery

Handle reload requests for unknown plugins safely without affecting existing plugins or registries.

Bug Fixes:

  • Return a plugin-not-found result when a specified plugin name cannot be resolved instead of falling back to reload-all.
  • Ensure reload requests for unknown or empty plugin names do not terminate plugins, unbind handlers, clear registries, or trigger plugin reloads.

Tests:

  • Add regression tests verifying that reload of unknown or empty plugin names produces a not-found response and leaves plugin and handler registries unchanged.

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.

[Bug] Reloading an unresolved plugin name unexpectedly reloads all plugins

1 participant