fix(gateway): preserve top-level platform config keys#10453
fix(gateway): preserve top-level platform config keys#10453briandevans wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes gateway platform config parsing so adapter-specific settings defined as top-level keys under config.yaml platform blocks (e.g. platforms.webhook.port) are preserved by folding them into PlatformConfig.extra, ensuring adapters like webhook and api_server actually receive those values.
Changes:
- Update
PlatformConfig.from_dict()to promote unknown top-level platform keys intoextra, with explicit nestedextrataking precedence on conflicts. - Add regression tests covering both the parser behavior and
load_gateway_config()end-to-end bridging fromconfig.yaml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
gateway/config.py |
Adjusts platform config parsing to retain unknown top-level keys by merging them into extra. |
tests/gateway/test_config.py |
Adds tests to prevent regressions for shorthand platform config keys flowing into config.extra. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
[gus-first-pass] Reviewed PR #10453: fix(gateway): preserve top-level platform config keys. Found potential issues regarding documentation that should be addressed. |
RuckVibeCodes
left a comment
There was a problem hiding this comment.
This change appears necessary; although, ensure to mention the backward compatibility in the documentation.
|
@RuckVibeCodes I updated the PR body to call out backward compatibility explicitly: the existing nested |
|
Thanks for fixing this. I hit the same silent-drop bug when configuring My approach was a warning-only fix, but auto-promoting unknown keys into LGTM — |
|
@jleechan2015 Thanks for the signal-boost! Agreed — warning-only is safer in isolation, but the precedence-aware auto-promote matches how most folks (including you, apparently) actually expect YAML config to behave. If you find any other keys that silently drop, happy to extend the catalog in a follow-up. |
|
Closing to keep the queue clean — |
What does this PR do?
Fixes
gateway/config.pyso top-level platform settings underconfig.yamlare preserved instead of being silently dropped duringPlatformConfig.from_dict().The bug is that
load_gateway_config()correctly deep-mergesplatforms.<name>blocks fromconfig.yaml, butPlatformConfig.from_dict()only kept a fixed allowlist of fields and discarded everything else unless it was nested underextra:. Adapters likewebhookandapi_serverread their settings fromconfig.extra, so shorthand config such asplatforms.webhook.port: 9100never reached the adapter.This stays narrow at the parser boundary:
extraextramappings remain backward compatible and still take precedence on overlapextravalues are ignored with a warning instead of being passed through silentlyRelated Issue
Fixes #10206
Type of Change
Changes Made
gateway/config.pysoPlatformConfig.from_dict()copies unknown top-level platform keys intoextraextravalues when both shorthand andextraforms are presentextrais present but not a mapping, so adapters do not silently receive an invalid shapetests/gateway/test_config.pyfor:extraextravalues being ignored with a warningload_gateway_config()loadingplatforms.webhook.host/platforms.webhook.portfromconfig.yamlHow to Test
~/.hermes/config.yaml:hermes gateway(or load config throughgateway.config.load_gateway_config()).host=0.0.0.0andport=9100instead of falling back to defaults.port=9100and logs a warning about the invalidextravalue.Validation
Focused and adjacent checks run locally:
source /Users/magic/Documents/Code/hermes-agent/venv/bin/activate && python -m pytest tests/gateway/test_config.py -q→20 passedsource /Users/magic/Documents/Code/hermes-agent/venv/bin/activate && python -m pytest tests/gateway/test_api_server.py -q→114 passedgit diff --check→ passedsource /Users/magic/Documents/Code/hermes-agent/venv/bin/activate && python -m py_compile gateway/config.py tests/gateway/test_config.py→ passedI also ran the repo’s documented broad local test command:
source /Users/magic/Documents/Code/hermes-agent/venv/bin/activate && python -m pytest tests/ -q --ignore=tests/integration --ignore=tests/e2e --tb=short -n autoThat command is not clean in this checkout: it ended with
98 failed, 11309 passed, 93 skipped, 60 errors, including missing optional dependencies (acp,fastapi,faster_whisper) and unrelated failures in ACP, web server, Discord, Telegram, and other areas outside this patch.No separate standalone lint command appears in the repo docs, so I did not invent one.
Tested locally on macOS
26.5with Python3.11.Adjacent surfaces checked:
gateway/platforms/webhook.pyreadshost/portfromconfig.extragateway/platforms/api_server.pyreadshost/portfromconfig.extraChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass26.5Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A