fix(gateway): honor nested gateway.* form for 9 more top-level keys - #67982
Merged
Conversation
load_gateway_config() already accepted both the top-level key and the nested gateway.<key> form (written by `hermes config set gateway.<key> ...`) for multiplex_profiles, max_concurrent_sessions, streaming, and write_sessions_json — each fixed one at a time as users hit it (most recently #59320 for multiplex_profiles). Nine sibling top-level keys never got the same nested fallback: session_reset, quick_commands, stt, stt_echo_transcripts, group_sessions_per_user, thread_sessions_per_user, reset_triggers, always_log_local, and unauthorized_dm_behavior. `hermes config set gateway.<any-of-these> ...` builds exactly this nested shape (hermes_cli/config.py's _set_nested has no schema, so it accepts any dotted path), so a user following the same pattern that legitimately works for gateway.multiplex_profiles/gateway.streaming gets a silent no-op for these nine keys instead. Fix: read `gateway: {...}` into a single `gateway_section` variable once (consolidating three separate `yaml_cfg.get("gateway")` calls already in the function) and add the same top-level-wins/nested-fallback check for each of the nine keys, mirroring the existing write_sessions_json precedent exactly. Note: because every fallback here is guarded by `isinstance(gateway_section, dict)`, this also makes the streaming fallback tolerate a scalar `gateway:` block (e.g. `gateway: disabled`) without crashing — the same crash #40837 (open) targets specifically for streaming. This change doesn't set out to fix that PR's issue, but the consolidated guard covers it as a side effect; flagging it for the reviewer rather than leaving it to be found in review.
…llback Follow-up for salvaged PR #59779: the session_reset and stt fallbacks used truthiness/type checks, so a present-but-empty top-level value was silently replaced by the nested gateway.* form — inconsistent with the key-presence precedence every other key in the block uses. Switch both to 'key not in yaml_cfg' gating and add precedence regression tests.
Collaborator
Related: this maintainer salvage carries the nested |
4 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
Settings written as
gateway.<key>in config.yaml (the shapehermes config set gateway.<key> ...naturally produces) now reach the gateway for 9 more keys, instead of being silently ignored.Salvage of PR #59779 by @pierrenode (authorship preserved via cherry-pick). Root cause:
load_gateway_config()bridged these settings only from top-level YAML while sibling settings (streaming, multiplex_profiles, write_sessions_json) already accepted the nested form.Changes
gateway/config.py: nestedgateway.*fallback for session_reset, quick_commands, stt, stt_echo_transcripts, group_sessions_per_user, thread_sessions_per_user, reset_triggers, always_log_local, filter_silence_narration, unauthorized_dm_behavior — top-level wins, nested falls backsession_reset/sttfallbacks from truthiness/type checks to key-presence gating, fixing the two precedence inconsistencies flagged in the sweeper review — a present-but-empty top-level value can no longer be replaced by the nested formtests/gateway/test_config.py: 9 nested-form tests (contributor's) + 2 key-presence precedence regression tests (ours)Validation
gateway.reset_triggers: [/fresh]session_reset: {}+gateway.session_reset.mode: idlescripts/run_tests.sh tests/gateway/test_config.pyE2E: real
load_gateway_config()against a temp HERMES_HOME with all 6 nested keys set → every value reaches GatewayConfig; precedence cases verified.Closes #59779's underlying report; conflict with a7f65e3's scalar-gateway guard and the profile_routes block resolved in favor of current main.
Infographic