Skip to content

fix(gateway): bridge gateway_restart_notification from YAML platform sections to PlatformConfig#26896

Closed
colin-chang wants to merge 1 commit into
NousResearch:mainfrom
colin-chang:fix/gateway-restart-notification-config-bridge
Closed

fix(gateway): bridge gateway_restart_notification from YAML platform sections to PlatformConfig#26896
colin-chang wants to merge 1 commit into
NousResearch:mainfrom
colin-chang:fix/gateway-restart-notification-config-bridge

Conversation

@colin-chang

Copy link
Copy Markdown
Contributor

Bug Description

Setting gateway_restart_notification: false in 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:

  1. Missing bridge key: The shared-key bridging loop in load_gateway_config() (lines ~806-853) omitted gateway_restart_notification from its bridge list. Other comparable keys like require_mention, reply_to_mode, dm_policy etc. were all bridged — this one was simply missed when the feature was added.

  2. No extra fallback in from_dict(): Bridged values land in platforms_data["<plat>"]["extra"], but PlatformConfig.from_dict() only read gateway_restart_notification from the top-level dict. Since the bridging loop put it in extra, from_dict() never saw it and always fell through to the default (True).

The net effect: discord: gateway_restart_notification: false in config.yaml was a no-op.

Fix

  • gateway/config.py bridging loop: Add gateway_restart_notification to the set of bridged keys so it propagates from YAML discord: / telegram: sections into platforms_data.
  • PlatformConfig.from_dict(): Fall back to data["extra"]["gateway_restart_notification"] when the top-level key is absent. Top-level takes precedence when both are present.

How to Verify

  1. Add gateway_restart_notification: false under a discord: section in ~/.hermes/config.yaml
  2. Restart the gateway
  3. Confirm the "⚠️ Gateway shutting down" notification is not sent to Discord
  4. Remove the setting → confirm notifications resume (default True)

Test Plan

  • Added regression test: PlatformConfig.from_dict() reads from extra fallback
  • Added regression test: top-level takes precedence over extra
  • Added regression test: end-to-end load_gateway_config() bridges discord: gateway_restart_notification: false
  • Added regression test: end-to-end load_gateway_config() bridges telegram: gateway_restart_notification: false
  • Added regression test: default True when not set
  • All 158 existing tests in related test files still pass

Risk 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. The extra fallback in from_dict() only activates when the top-level key is absent, preserving existing behavior for configs that set the key through gateway.json (which writes to the top level).

…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.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles labels May 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of open #24661 (earliest open fix for #24644). Multiple competing PRs exist (#24661, #24663). Please consolidate — this is the 6th+ PR addressing the same gateway_restart_notification bridge bug.

@teknium1

Copy link
Copy Markdown
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.

@teknium1 teknium1 closed this Jun 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants