Skip to content

fix(gateway): load reply_to_mode from config.yaml for Discord and Telegram#13930

Closed
ishardo wants to merge 1 commit into
NousResearch:mainfrom
ishardo:fix/discord-reply-to-mode-yaml
Closed

fix(gateway): load reply_to_mode from config.yaml for Discord and Telegram#13930
ishardo wants to merge 1 commit into
NousResearch:mainfrom
ishardo:fix/discord-reply-to-mode-yaml

Conversation

@ishardo

@ishardo ishardo commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Setting reply_to_mode under discord: or telegram: in ~/.hermes/config.yaml had no effect — the YAML→env-var mapping was never added for this key, though it exists for every sibling setting (require_mention, allow_mentions, reactions, etc.). Users set it in YAML, see no behavior change, and have no indication why.

This PR supersedes and extends #9837 (cc @Hypn0sis, credited as co-author) to cover both Discord and Telegram with identical handling logic.

What's included

  • Discord: discord.reply_to_modeDISCORD_REPLY_TO_MODE
  • Telegram: telegram.reply_to_modeTELEGRAM_REPLY_TO_MODE
  • Both accept top-level (<platform>.reply_to_mode) AND nested (<platform>.extra.reply_to_mode) keys
  • Both handle YAML 1.1's bare off → Python False edge case by mapping back to the string "off" so downstream code gets a valid mode name (critical — this is the trap that originally motivated fix(config): load discord.reply_to_mode from config.yaml #9837)
  • Env vars still take precedence (mapping only fires when env is unset)
  • 5 unit tests each for Discord and Telegram: top-level, extra-path, env-var precedence, top-level-over-extra precedence

Test plan

  • Unit tests added (10 total, all passing locally)
  • Manual test: discord.reply_to_mode: \"off\" stops Discord reply threading after restart
  • Manual test: discord.reply_to_mode: off (bare, YAML 1.1 → False) also correctly maps to \"off\" string
  • Env var precedence verified: DISCORD_REPLY_TO_MODE=first overrides YAML reply_to_mode: all

Closes

Closes #9837 (subsumed by this PR — same Discord fix plus Telegram parity + tests for both)

🤖 Generated with Claude Code

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles platform/discord Discord bot adapter platform/telegram Telegram bot adapter labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related: PR #9837 fixes the same discord.reply_to_mode mapping gap (also handles YAML 1.1 bare off→False). Maintainers should coordinate to avoid conflicts.

@ishardo ishardo force-pushed the fix/discord-reply-to-mode-yaml branch from cd2ce52 to b22f7d8 Compare April 22, 2026 21:41
@ishardo ishardo changed the title fix(gateway): map reply_to_mode YAML keys to env vars for Discord/Telegram fix(gateway): load reply_to_mode from config.yaml for Discord and Telegram Apr 22, 2026
@ishardo

ishardo commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @alt-glitch for flagging #9837 — I've updated this PR to supersede it with @Hypn0sis credited as co-author in the commit trailer.

The new diff:

If @Hypn0sis would prefer to land their PR first and I'll send a follow-up Telegram-only PR, I'm happy to close this instead. Just let me know.

…egram

Setting `reply_to_mode` under `discord:` or `telegram:` in config.yaml
had no effect because the YAML→env-var mapping was never added, while
it exists for every sibling setting (require_mention, allow_mentions,
reactions, etc.). Users would set it in YAML, see no change, and have
no indication why.

This fix supersedes and extends PR #9837 (Hypn0sis) to cover Telegram
as well, with identical handling logic:

  * Accept both top-level (`<platform>.reply_to_mode`) and nested
    (`<platform>.extra.reply_to_mode`) keys.
  * Handle YAML 1.1's bare `off` → Python `False` by mapping back
    to the string `"off"` so `_coerce_...` / adapter code gets a
    valid mode name.
  * Env var takes precedence (mapping only fires when env is unset),
    matching the pattern used for every sibling setting.

Adds 5 tests each for Discord and Telegram covering top-level, extra
path, env-var precedence, and top-level-over-extra precedence.

Closes #9837 (subsumed).

Co-authored-by: Hypn0sis <79463307+Hypn0sis@users.noreply.github.com>
@ishardo ishardo force-pushed the fix/discord-reply-to-mode-yaml branch from b22f7d8 to 256e4cd Compare April 22, 2026 21:43
@Hypn0sis

Copy link
Copy Markdown
Contributor

No objection at all — your combined PR is the better shape for this fix. Happy to close #9837 once #13930 merges. Thanks for the co-author credit.

@ishardo ishardo closed this by deleting the head repository Apr 28, 2026
teknium1 pushed a commit that referenced this pull request May 5, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from #9837 and #13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
teknium1 pushed a commit that referenced this pull request May 5, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from #9837 and #13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
teknium1 pushed a commit that referenced this pull request May 5, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from #9837 and #13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
nickdlkk pushed a commit to nickdlkk/hermes-agent that referenced this pull request May 11, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
rmulligan pushed a commit to rmulligan/hermes-agent that referenced this pull request May 11, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
JinyuID pushed a commit to JinyuID/hermes-agent that referenced this pull request May 11, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…egram

The YAML-to-env-var bridge in load_gateway_config() mapped every Discord
and Telegram config key (require_mention, auto_thread, reactions, etc.)
except reply_to_mode. Users setting discord.reply_to_mode or
telegram.reply_to_mode in ~/.hermes/config.yaml got no effect — the
adapter only read the env var, which nothing populated from YAML.

Add the missing bridge for both platforms, following the existing pattern.
Top-level <platform>.reply_to_mode preferred, falls back to
<platform>.extra.reply_to_mode, env var never overwritten. Handles YAML
1.1 bare `off` → Python False coercion.

This is a re-submission of the work from NousResearch#9837 and NousResearch#13930, which both
implemented the same fix but neither landed (see co-authors below).

Co-authored-by: Matteo De Agazio <hypnosis.mda@gmail.com>
Co-authored-by: ishardo <239075732+ishardo@users.noreply.github.com>
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 P2 Medium — degraded but workaround exists platform/discord Discord bot adapter platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants