fix: unify plugin config source#240
Merged
EterUltimate merged 3 commits intoJul 9, 2026
Merged
Conversation
Contributor
Reviewer's GuideThis PR makes AstrBot’s grouped plugin settings the single runtime configuration source, removes the legacy WebUI plugin_data/config.json read/write path, archives any existing legacy file on startup, and ensures WebUI changes (including log level/debug mode) are persisted back into the AstrBot config and applied to runtime. Sequence diagram for WebUI config updates persisted to AstrBot and runtime log settingssequenceDiagram
actor WebUser as WebUIUser
participant ConfigSvc as ConfigService
participant PluginConfig as PluginConfig
participant AstrBotConfig as AstrBotConfig
participant Monitor as MonitoringInstrumentation
WebUser->>ConfigSvc: update_config(new_config)
ConfigSvc->>ConfigSvc: _get_astrbot_config()
ConfigSvc->>AstrBotConfig: [AstrBot config must be available]
ConfigSvc->>PluginConfig: [apply validated_config fields]
ConfigSvc->>ConfigSvc: _apply_runtime_log_settings()
ConfigSvc->>PluginConfig: log_level, debug_mode updated
ConfigSvc->>Monitor: set_debug_mode(debug_mode)
ConfigSvc->>Monitor: set_trace_enabled(log_level == "trace")
ConfigSvc->>ConfigSvc: _clear_astrbot_initial_password(astrbot_config)
ConfigSvc->>AstrBotConfig: save_config()
ConfigSvc->>ConfigSvc: _remember_config_sync_state(astrbot_config)
ConfigSvc-->>WebUser: (success, message, redacted_config)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
forceparameter in_sync_config_sourcesis now effectively unused (the method always applies AstrBot config regardless of signatures); consider either reintroducing conditional behavior based onforceor removing the parameter to avoid confusion. - The new
_archive_legacy_config_copyhelper is invoked in two separate initialization paths with duplicated arguments; you could centralize that call in a single place afterPluginConfig.create_from_runtime_sourcesto avoid having to remember to update both branches in future.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `force` parameter in `_sync_config_sources` is now effectively unused (the method always applies AstrBot config regardless of signatures); consider either reintroducing conditional behavior based on `force` or removing the parameter to avoid confusion.
- The new `_archive_legacy_config_copy` helper is invoked in two separate initialization paths with duplicated arguments; you could centralize that call in a single place after `PluginConfig.create_from_runtime_sources` to avoid having to remember to update both branches in future.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Summary
Tests
Summary by Sourcery
Unify runtime configuration to use AstrBot’s plugin settings as the single authoritative source and retire the legacy WebUI config file.
Enhancements:
Tests: