Skip to content

Bug: Plugin platforms ignore ${PREFIX}_HOME_CHANNEL env var in _apply_env_overrides() #19440

@Quarkex

Description

@Quarkex

Description

When sending a message to a plugin platform (e.g. XMPP) from a different platform session, send_message fails with:

No home channel set for xmpp to determine where to send the message.

This happens even when XMPP_HOME_CHANNEL is correctly set in .env.

Root Cause

In gateway/config.py, _apply_env_overrides() has hardcoded blocks for each built-in platform (Telegram, Discord, Slack, QQBot, Yuanbao, etc.) that read their respective {PREFIX}_HOME_CHANNEL env vars and populate config.platforms[platform].home_channel.

However, the generic plugin platform enable loop ("Registry-driven enable for plugin platforms" block) only sets config.platforms[platform].enabled = True — it never reads or applies home channel configuration from the environment.

Steps to Reproduce

  1. Install a plugin platform (e.g. XMPP)
  2. Set XMPP_HOME_CHANNEL=room@conference.example.org in .env
  3. From a different platform (e.g. Telegram), call send_message targeting xmpp
  4. Observe error despite env var being correctly set

Suggested Fix

Add home channel setup after the enabled = True line in the plugin platform loop:

config.platforms[platform].enabled = True
# Set home_channel from env if available (e.g. XMPP_HOME_CHANNEL)
prefix = entry.name.upper().replace("-", "_")
home_val = os.getenv(f"{prefix}_HOME_CHANNEL")
if home_val and not config.platforms[platform].home_channel:
    config.platforms[platform].home_channel = HomeChannel(
        platform=platform,
        chat_id=home_val,
        name=os.getenv(f"{prefix}_HOME_CHANNEL_NAME", "Home"),
    )

Impact

Affects all plugin platforms. Any plugin that sets {NAME}_HOME_CHANNEL in .env will silently fail on cross-platform sends. The pattern of adding hardcoded blocks per platform (as seen in PR #13767 for MS Teams) does not scale — the generic loop should handle this for all plugins uniformly.

Environment

  • hermes-agent main branch (as of 2026-05-04)
  • Affected file: gateway/config.py, function _apply_env_overrides()

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/gatewayGateway runner, session dispatch, deliverycomp/pluginsPlugin system and bundled pluginstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions