fix(gateway/config): merge top-level platform keys into extra (#20501)#20506
Open
Beandon13 wants to merge 1 commit into
Open
fix(gateway/config): merge top-level platform keys into extra (#20501)#20506Beandon13 wants to merge 1 commit into
Beandon13 wants to merge 1 commit into
Conversation
…search#20501) PlatformConfig.from_dict() previously read platform-specific settings only from the explicit ``extra`` mapping. ``hermes config set platforms.api_server.port 8643`` writes the value at ``platforms.api_server.port`` (not nested under ``extra``), so the gateway silently ignored it and bound to the default 8642 with no warning. Top-level keys other than the dedicated PlatformConfig fields (enabled, token, api_key, home_channel, reply_to_mode, extra) are now merged into ``extra`` so adapters that read ``config.extra.get(...)`` see what users actually configured. Explicit ``extra`` entries still win on conflict so the to_dict→from_dict roundtrip remains stable. Adds three regression tests covering the natural top-level layout, the extra-wins precedence, and the reserved-keys carve-out.
Collaborator
|
Duplicate of #10453 (and related to #10208). Both fix the same underlying bug: |
This was referenced May 6, 2026
Closed
19 tasks
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
Fixes #20501 —
platforms.api_serverconfig values (port,host,key,cors_origins) are silently ignored when written at the natural top level instead of nested underextra.Root cause
PlatformConfig.from_dict()ingateway/config.pyonly read platform-specific values fromdata.get("extra", {}). Buthermes config set platforms.api_server.port 8643writes the value atplatforms.api_server.port(top level of the platform block, which is the natural and documented YAML shape and matches the error message inapi_server.py:3112). The result: gateway falls back to default 8642 with no warning, no error, no log line — extremely hard to debug.Fix
In
PlatformConfig.from_dict(), merge any top-level keys that aren't dedicated PlatformConfig fields (enabled,token,api_key,home_channel,reply_to_mode,extra) into theextradict. Explicitextraentries still win on key collision so theto_dict→from_dictroundtrip remains stable for existing configs.This is a minimal, additive change — existing nested-under-
extraconfigs keep working unchanged; the new behavior only kicks in for top-level keys that were previously dropped on the floor.Test plan
port/host/key/cors_originsnow reachextraextrawins over a stale top-level key (roundtrip stability)token,api_key,reply_to_mode) still consumed as fields, not pushed intoextratests/gateway/test_config.pypassAffected adapters
Any platform whose adapter reads
config.extra.get(...)benefits. The reported issue isapi_server(port/host/key/cors_origins/model_name) but the same pattern is used across other platform adapters, so they all become more forgiving of natural top-level config layout.