Skip to content

fix(gateway): honor nested gateway.* form for 9 more top-level keys - #67982

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-f2e2a207
Jul 20, 2026
Merged

fix(gateway): honor nested gateway.* form for 9 more top-level keys#67982
teknium1 merged 2 commits into
mainfrom
hermes/hermes-f2e2a207

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Settings written as gateway.<key> in config.yaml (the shape hermes 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: nested gateway.* 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 back
  • Follow-up (ours): switched session_reset/stt fallbacks 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 form
  • tests/gateway/test_config.py: 9 nested-form tests (contributor's) + 2 key-presence precedence regression tests (ours)

Validation

Before After
gateway.reset_triggers: [/fresh] ignored honored
session_reset: {} + gateway.session_reset.mode: idle nested leaked through top-level presence wins
scripts/run_tests.sh tests/gateway/test_config.py 130/130 pass

E2E: 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

nested-gateway-keys

pierrenode and others added 2 commits July 20, 2026 03:17
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.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists needs-decision Awaiting maintainer decision before any implementation sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: this maintainer salvage carries the nested gateway.* fallback work from open #59779 and additionally hardens top-level key-presence precedence. It is not a duplicate.

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 needs-decision Awaiting maintainer decision before any implementation P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants