fix(gateway): bridge gateway_restart_notification from YAML platform sections to PlatformConfig#26896
Closed
colin-chang wants to merge 1 commit into
Closed
Conversation
…sections to PlatformConfig Setting `gateway_restart_notification: false` in config.yaml platform sections (e.g. `discord:`, `telegram:`) was silently ignored — the setting never reached the PlatformConfig object, so restart/shutdown notifications were always sent regardless of the user's preference. Root cause (two-part): 1. The shared-key bridging loop in load_gateway_config() omitted `gateway_restart_notification` from its bridge list, so the value from `discord:` YAML never entered `platforms_data`. 2. PlatformConfig.from_dict() only read the key from the top-level dict, not from `extra` where bridged values are stored. Fix: - Add `gateway_restart_notification` to the bridging loop so the YAML value propagates into `platforms_data["<plat>"].extra`. - Update PlatformConfig.from_dict() to fall back to `extra` when the top-level key is absent, matching the pattern used by other bridged settings. Regression tests added for both from_dict() extra-fallback and the end-to-end load_gateway_config() bridging path.
Collaborator
3 tasks
Contributor
|
Automated hermes-sweeper review: this duplicate fix is already on current main. Evidence:
Thanks for the fix — this PR's requested behavior has landed on main. |
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.
Bug Description
Setting
gateway_restart_notification: falsein config.yaml platform sections (e.g.discord:,telegram:) was silently ignored — restart/shutdown notifications were always sent to the platform regardless of the user's preference.Root Cause
Two-part breakage in the config loading pipeline:
Missing bridge key: The shared-key bridging loop in
load_gateway_config()(lines ~806-853) omittedgateway_restart_notificationfrom its bridge list. Other comparable keys likerequire_mention,reply_to_mode,dm_policyetc. were all bridged — this one was simply missed when the feature was added.No
extrafallback infrom_dict(): Bridged values land inplatforms_data["<plat>"]["extra"], butPlatformConfig.from_dict()only readgateway_restart_notificationfrom the top-level dict. Since the bridging loop put it inextra,from_dict()never saw it and always fell through to the default (True).The net effect:
discord: gateway_restart_notification: falsein config.yaml was a no-op.Fix
gateway/config.pybridging loop: Addgateway_restart_notificationto the set of bridged keys so it propagates from YAMLdiscord:/telegram:sections intoplatforms_data.PlatformConfig.from_dict(): Fall back todata["extra"]["gateway_restart_notification"]when the top-level key is absent. Top-level takes precedence when both are present.How to Verify
gateway_restart_notification: falseunder adiscord:section in~/.hermes/config.yamlTrue)Test Plan
PlatformConfig.from_dict()reads fromextrafallbackextraload_gateway_config()bridgesdiscord: gateway_restart_notification: falseload_gateway_config()bridgestelegram: gateway_restart_notification: falseTruewhen not setRisk Assessment
Low — The fix only affects the config loading path for
gateway_restart_notification. Other config keys use the same bridging pattern and are unaffected. Theextrafallback infrom_dict()only activates when the top-level key is absent, preserving existing behavior for configs that set the key throughgateway.json(which writes to the top level).