fix(channel): reuse stored credentials when re-enabling a plugin#458
Open
szafranski wants to merge 1 commit into
Open
fix(channel): reuse stored credentials when re-enabling a plugin#458szafranski wants to merge 1 commit into
szafranski wants to merge 1 commit into
Conversation
The Settings re-enable toggle sends an empty config `{}` and relies on
the previously stored credentials. `enable_plugin` rejected this with
`InvalidConfig("missing field credentials")`, so a channel could be
enabled once but never re-enabled after being disabled — the toggle
reverted and the bot never restarted.
Resolve the effective config before starting: when an enable request
omits credentials, fall back to the persisted (encrypted) config instead
of failing. Configs that do carry credentials are still validated as
before, so genuinely malformed input is reported as `InvalidConfig`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d4e96fb to
5ed1bc1
Compare
Author
|
Small coordination bump: this still looks like the backend half of the channel re-enable fix described in iOfficeAI/AionUi#3153. The UI side can surface failures more honestly, but the actual "disable -> re-enable without retyping credentials" path still depends on this AionCore change reusing the stored encrypted config. When preparing the next coordinated release, could we make sure this is bundled with the UI-side work so the Settings toggle behavior is fixed end-to-end? Thanks! |
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.
Problem
A channel plugin (Telegram, Lark, …) can be enabled once but never re-enabled after being disabled. The Settings re-enable toggle sends an empty config
{}(the token only lives in renderer state and is not re-typed), andenable_pluginrejected it withInvalidConfig("missing field credentials"). The toggle reverted and the bot never restarted.This is the root cause of the symptom reported in iOfficeAI/AionUi#3153.
Fix
Resolve the effective config before starting the plugin: when an enable request carries no credentials, fall back to the previously persisted (encrypted) config instead of failing. Configs that do carry credentials are still validated as before, so genuinely malformed input is still reported as
InvalidConfig.enable_pluginnow resolves the config viaconfig_with_credentials(returns the supplied config only when it carries credentials) andload_stored_config(decrypts the persisted config to reuse).disable_pluginalready preserves the stored config row, so the credentials are available to reuse.Tests
Added
ep6_re_enable_empty_config_reuses_stored_credentials(enable → disable → re-enable with{}→ plugin running, stored token reused). Verified it fails before the fix (InvalidConfig("missing field credentials")) and passes after.cargo test -p aionui-channel→ 27 passedcargo nextest run -p aionui-channel -p aionui-app→ 1177 passedcargo clippy --workspace -- -D warnings→ cleancargo fmt --all -- --check→ cleanLogging
No new logs: the success path already emits
info!(... "plugin enabled and started"), and the no-stored-config failure surfaces asInvalidConfig(logged by the route'swarn!). Existing observability is sufficient.Related
iOfficeAI/AionUi#3153 — the companion renderer PR surfaces the previously-silent failure in the UI.