Skip to content

fix(gateway): accept explicit null home_channel in PlatformConfig.from_dict#13721

Closed
hclsys wants to merge 1 commit into
NousResearch:mainfrom
hclsys:fix/platform-config-null-home-channel-13708
Closed

fix(gateway): accept explicit null home_channel in PlatformConfig.from_dict#13721
hclsys wants to merge 1 commit into
NousResearch:mainfrom
hclsys:fix/platform-config-null-home-channel-13708

Conversation

@hclsys

@hclsys hclsys commented Apr 21, 2026

Copy link
Copy Markdown

Summary

Fixes #13708. PlatformConfig.from_dict() crashes on the common YAML pattern of explicitly clearing an optional nested section with null:

```yaml
platforms:
telegram:
enabled: true
home_channel: null
```

Current code only checks for key-presence (`if "home_channel" in data`) and then unconditionally passes the value into `HomeChannel.from_dict()`, which subscripts it like a dict and raises `TypeError: 'NoneType' object is not subscriptable`.

Fix

One-line guard change: switch to `data.get("home_channel") is not None` so explicit `null` is treated the same as absent.

Test

Added a regression test covering the explicit-null YAML shape. All 28 tests in `tests/gateway/test_config.py` pass locally.

Scope

Pure bug-fix, purely additive semantics. No behavior change for existing callers (a dict home_channel still round-trips identically; missing home_channel still yields `None`). I audited all production and test callers of `PlatformConfig.from_dict()` — only one production call site in the same file at L384 (`load_gateway_config`) and 5 test sites; none pass `None` today so existing contract is preserved.

Closes #13708.

…m_dict (NousResearch#13708)

YAML 'home_channel: null' is a common way to clear an optional nested
section. Current code only checks key-presence and passes None into
HomeChannel.from_dict(), which subscripts it and crashes with
TypeError: 'NoneType' object is not subscriptable.

Treat explicit null the same as absent by switching the guard to
data.get('home_channel') is not None.

Add a regression test covering the explicit-null YAML shape.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles labels Apr 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #13319 (closed) which addressed null-safe deserialization in the same config area — this covers the specific home_channel: null case.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #13319 (closed) which addressed null-safe deserialization in the same config area — this covers the specific home_channel: null case.

@hclsys

hclsys commented Apr 23, 2026

Copy link
Copy Markdown
Author

Closing — not pursuing further. Thanks for the triage.

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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: gateway config loading crashes on explicit home_channel: null

2 participants