fix: refresh in-memory provider config after deleting provider - #9568
Merged
Soulter merged 1 commit intoAug 7, 2026
Merged
Conversation
ProviderManager.delete_provider removed the provider from the persisted config but left self.providers_config pointing at the stale list, so the dashboard kept showing deleted providers until a reload or restart. Sync self.providers_config with the just-saved config after deletion so the API/provider list reflects the removal immediately.
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider extracting the
providers_configrefresh logic into a small helper used bycreate_provider,delete_provider, and any other mutating operations to ensure the in-memory config is consistently updated across all code paths.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the `providers_config` refresh logic into a small helper used by `create_provider`, `delete_provider`, and any other mutating operations to ensure the in-memory config is consistently updated across all code paths.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Soulter
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modifications / 改动点
ProviderManager.delete_provider()removes the provider from the persisted config and terminates its instance, but it never syncs the in-memoryproviders_config. As a result, the dashboard's provider list (which readsprovider_manager.providers_config) keeps showing the deleted provider until the process restarts or another operation triggers a reload.This change syncs
providers_configwith the just-saved config immediately after deletion (same pattern already used increate_provider), covering both delete-by-provider_idand delete-by-provider_source_idpaths.astrbot/core/provider/manager.py(delete_provider)Screenshots or Test Results / 运行截图或测试结果
Verified in a fully-synced dev environment:
tests/unit/test_provider_manager_delete.py) for this fix:2 passed.test_provider_stats.py,test_config.py,test_core_lifecycle.py,test_star_context.py):78 passed.ruff checkandruff format --checkpass on the modified file.Note: 3
t2itemplate tests intests/test_dashboard.pyfail, but they also fail on a clean checkout ofmasterand are unrelated to this change.Checklist / 检查清单
Summary by Sourcery
Ensure provider deletions immediately refresh the in-memory provider configuration to keep API consumers in sync with persisted config.
Bug Fixes:
Tests: