Skip to content

fix(config): load discord.reply_to_mode from config.yaml#9837

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

fix(config): load discord.reply_to_mode from config.yaml#9837
Hypn0sis wants to merge 1 commit into
NousResearch:mainfrom
Hypn0sis:fix/discord-reply-to-mode-yaml-config

Conversation

@Hypn0sis

Copy link
Copy Markdown
Contributor

Problem

discord.reply_to_mode (and discord.extra.reply_to_mode) set in config.yaml was silently ignored. The gateway only honoured the DISCORD_REPLY_TO_MODE environment variable, so users who configured the value via YAML got no effect and the adapter always fell back to the default (first).

The same YAML-to-env-var bridge already exists for require_mention, auto_thread, free_response_channels, reactions, ignored_channels, allowed_channels, and no_thread_channelsreply_to_mode was the only Discord config key missing it.

Fix

gateway/config.py — add reply_to_mode to the Discord YAML env-var bridge block (lines ~583-614), following the existing pattern. Two lookup paths are supported for backwards compatibility:

  • discord.reply_to_mode (preferred, top-level)
  • discord.extra.reply_to_mode (legacy, for configs that placed it under extra:)

Top-level takes precedence. An existing DISCORD_REPLY_TO_MODE env var is never overwritten.

YAML 1.1 edge case handled: bare off in YAML is parsed as boolean False by PyYAML. The fix detects False and normalises it to the string "off" before setting the env var.

Tests

5 new tests added to tests/gateway/test_discord_reply_mode.py (TestYamlConfigLoading):

  • test_top_level_reply_to_mode_off — bare off (YAML boolean False) → "off"
  • test_top_level_reply_to_mode_all — string all"all"
  • test_extra_reply_to_mode_off — quoted "off" under extra:"off"
  • test_env_var_takes_precedence_over_yaml — pre-existing env var not overwritten
  • test_top_level_takes_precedence_over_extra — top-level wins over extra:

All 33 tests in the file pass.

@Hypn0sis Hypn0sis force-pushed the fix/discord-reply-to-mode-yaml-config branch from b15f962 to dfc2a7d Compare April 14, 2026 20:21
@nidhishgajjar

Copy link
Copy Markdown

Orb Code Review (powered by GLM 5.1 on Orb Cloud)

PR #9837 — fix(config): load discord.reply_to_mode from config.yaml

What it does

Adds support for reading discord.reply_to_mode from config.yaml and exporting it to the DISCORD_REPLY_TO_MODE env var. Also includes two deployment scripts.

Observations

✅ Config fix is clean
The reply_to_mode loading logic correctly handles:

  • Top-level discord.reply_to_mode and nested discord.extra.reply_to_mode
  • YAML 1.1 quirk where bare off is parsed as boolean False → converted to string "off"
  • Env var precedence (doesn't overwrite existing DISCORD_REPLY_TO_MODE)

🚨 Security concern: deployment scripts expose private infrastructure

The two new scripts contain hardcoded default values that expose private infrastructure:

  • deploy-remote.sh line 24: REMOTE_HOST="${DEPLOY_HOST:-87.106.215.151}"
  • deploy-remote.sh line 23: REMOTE_USER="${DEPLOY_USER:-hypnosis}"
  • deploy-remote.sh line 25: REMOTE_SSH_KEY="${DEPLOY_SSH_KEY:-$HOME/.ssh/hypnoclaw-id_rsa}"
  • sync-upstream-and-deploy.sh references the same VPS

These defaults leak a public IP address, username, and SSH key path for a specific contributor's VPS. While env var overrides exist, committing infrastructure details to a public repository is a security risk.

Recommendation: Either:

  1. Remove the deployment scripts from this PR (they're unrelated to the config fix)
  2. Remove the hardcoded defaults and require env vars to be set explicitly (fail if unset)

Summary: The config fix for discord.reply_to_mode is correct and well-handled. However, the included deployment scripts expose private infrastructure details (IP address, username, SSH key path) that should not be committed to a public repository.

Assessment: request-changes (remove or sanitize the deployment scripts)

@Hypn0sis Hypn0sis force-pushed the fix/discord-reply-to-mode-yaml-config branch from 1232178 to 501b2af Compare April 14, 2026 21:46
@Hypn0sis

Hypn0sis commented Apr 14, 2026 via email

Copy link
Copy Markdown
Contributor Author

@Hypn0sis Hypn0sis force-pushed the fix/discord-reply-to-mode-yaml-config branch 4 times, most recently from 9fa6f85 to 6fd01f4 Compare April 20, 2026 07:24
@Hypn0sis

Copy link
Copy Markdown
Contributor Author

The 3 failing tests are upstream regressions unrelated to this PR.

This PR only touches gateway/config.py and tests/gateway/test_discord_reply_mode.py.

Failures:

  • test_gemini_provider.py::test_provider_models_exist — hardcoded gemini-2.5-pro is no longer in the model list (upstream renamed to gemini-3.x)
  • test_command_guards.py::test_warn_session_approved — session approval returns False instead of True
  • test_command_guards.py::test_combined_cli_session_approves_both — same session approval issue

None of these files are touched by this PR.

@Hypn0sis Hypn0sis force-pushed the fix/discord-reply-to-mode-yaml-config branch from 6fd01f4 to 0267ae0 Compare April 20, 2026 16:21
@Hypn0sis

Copy link
Copy Markdown
Contributor Author

Note: CI may show 2 unrelated upstream test failures:

  • tests/hermes_cli/test_tips.py::TestTipsCorpus::test_max_length_reasonable
  • tests/tools/test_browser_camofox.py::TestCamofoxVisionConfig::test_camofox_vision_uses_configured_temperature_and_timeout (asserts temperature == 1.0, gets 0.1)

Neither touches gateway/config.py or anything changed in this PR. Both are pre-existing regressions on main.

@Hypn0sis

Copy link
Copy Markdown
Contributor Author

Deferring to #13930 (by @ishardo) which supersedes this PR — extends the same fix to Telegram and includes full test coverage. Will close this once #13930 merges.

@Hypn0sis Hypn0sis force-pushed the fix/discord-reply-to-mode-yaml-config branch 2 times, most recently from 851a177 to 4e880c8 Compare April 28, 2026 14:07
…_REPLY_TO_MODE

discord.reply_to_mode (and discord.extra.reply_to_mode) in config.yaml was
silently ignored — the gateway only honoured the DISCORD_REPLY_TO_MODE env
var, leaving the YAML setting with no effect.

Apply the same env-var bridge already used for require_mention, auto_thread,
free_response_channels, etc.  Also handles YAML 1.1 bare 'off' (parsed as
boolean False) correctly.

Top-level discord.reply_to_mode takes precedence over discord.extra.reply_to_mode;
a pre-existing DISCORD_REPLY_TO_MODE env var is never overwritten.
@Hypn0sis Hypn0sis force-pushed the fix/discord-reply-to-mode-yaml-config branch from 4e880c8 to eb03ac7 Compare April 28, 2026 21:07
@Hypn0sis

Copy link
Copy Markdown
Contributor Author

Closing in favor of #17117 (ashermorse) which re-applies this fix with Telegram support added. Local patch retained on our branch until #17117 lands upstream.

@Hypn0sis Hypn0sis closed this 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 platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants