fix(gateway): tolerate null nested platform config entries#13319
Conversation
Repository owner
closed this by deleting the head repository
Apr 21, 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.
Summary
GatewayConfig.from_dict() and PlatformConfig.from_dict() were assuming that nested fields are always mappings in some legacy or manually edited config inputs. As a result, valid YAML/JSON values such as home_channel: null, extra: null, or platforms.telegram: null could cause exceptions during gateway startup and lead to config loading failures.
This PR makes config deserialization more robust by safely normalizing these fields.
Problem
The following types of config values could cause crashes:
platforms:
telegram: null
or
platforms:
telegram:
enabled: true
home_channel: null
extra: null
In the current flow:
This could produce AttributeError or type-related crashes when encountering values like None.
Fix
A minimal and merge-friendly fix has been applied:
This change does not alter behavior for valid configs; it only ensures safe fallback instead of crashes for malformed / missing / null nested values.
Tests
Two regression tests were added:
Verification
The following flows were manually verified:
PlatformConfig.from_dict({"enabled": True, "home_channel": None, "extra": None})
GatewayConfig.from_dict({"platforms": {"telegram": None}})
In both cases, expected default objects are now returned instead of exceptions.
Why this matters
This small fix: