hermes - ✅(Solved) Fix Bug: bare platform delivery targets never resolve configured home channels [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#13704Fetched 2026-04-22 08:04:38
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

gateway.delivery.DeliveryRouter documents and parses bare platform targets like telegram as "send to the platform home channel", but the actual delivery path rejects those targets with No chat ID for telegram delivery instead of resolving config.platforms[platform].home_channel.

Error Message

{'telegram': {'success': False, 'error': 'No chat ID for telegram delivery'}}

Root Cause

gateway.delivery.DeliveryRouter documents and parses bare platform targets like telegram as "send to the platform home channel", but the actual delivery path rejects those targets with No chat ID for telegram delivery instead of resolving config.platforms[platform].home_channel.

Fix Action

Fixed

PR fix notes

PR #13722: fix(gateway): resolve home_channel for bare platform delivery targets

Description (problem / solution / changelog)

Summary

Fixes #13704. DeliveryTarget.parse('telegram') returns chat_id=None and the module docstring + parse docstring both explicitly document that as 'send to the platform home channel'. But the actual delivery path rejects the same target with No chat ID for telegram delivery, so a documented delivery mode always fails at runtime.

Fix

In _deliver_to_platform, when target.chat_id is missing, look up self.config.platforms[target.platform].home_channel.chat_id and use that. Only raise if no home channel is configured either.

Explicit chat_id on the target still takes precedence (existing behavior preserved).

Test

Added 3 regression tests in tests/gateway/test_delivery.py:

  1. Bare platform target with home_channel → sends to the home channel (was the crash path).
  2. Bare platform target WITHOUT home_channel → still raises 'No chat ID' (preserves error for misconfigured cases).
  3. Explicit chat_id on target with home_channel configured → uses explicit chat_id (precedence preserved).

All 13 tests in tests/gateway/test_delivery.py pass locally.

Scope

1 file in production, 1 file in tests. Purely additive semantics for valid configs — the only behavior that flips is the documented-but-broken code path going from raise to success.

Closes #13704.

Changed files

  • gateway/delivery.py (modified, +17/-6)
  • tests/gateway/test_delivery.py (modified, +75/-2)

Code Example

import asyncio
from gateway.delivery import DeliveryTarget, DeliveryRouter
from gateway.config import GatewayConfig, Platform, PlatformConfig, HomeChannel

class DummyAdapter:
    async def send(self, chat_id, content, metadata=None):
        return {"chat_id": chat_id, "content": content, "metadata": metadata}

async def main():
    cfg = GatewayConfig(platforms={
        Platform.TELEGRAM: PlatformConfig(
            enabled=True,
            token="x",
            home_channel=HomeChannel(platform=Platform.TELEGRAM, chat_id="home123", name="Home"),
        )
    })
    router = DeliveryRouter(cfg, {Platform.TELEGRAM: DummyAdapter()})
    print(await router.deliver("hello", [DeliveryTarget.parse("telegram")]))

asyncio.run(main())

---

{'telegram': {'success': False, 'error': 'No chat ID for telegram delivery'}}
RAW_BUFFERClick to expand / collapse

Summary

gateway.delivery.DeliveryRouter documents and parses bare platform targets like telegram as "send to the platform home channel", but the actual delivery path rejects those targets with No chat ID for telegram delivery instead of resolving config.platforms[platform].home_channel.

Affected code

  • gateway/delivery.py:6-7 — module docstring says "telegram" → home channel
  • gateway/delivery.py:36-40, 53-54, 86-89DeliveryTarget.parse("telegram") returns chat_id=None to mean home-channel delivery
  • gateway/delivery.py:236-237_deliver_to_platform() raises if target.chat_id is missing

Why this is a bug

The parser and docs explicitly support platform-only delivery targets, and there are tests covering that parse shape. But the actual send path never resolves the configured home channel before enforcing chat_id, so a documented delivery mode always fails at runtime.

Minimal reproduction

import asyncio
from gateway.delivery import DeliveryTarget, DeliveryRouter
from gateway.config import GatewayConfig, Platform, PlatformConfig, HomeChannel

class DummyAdapter:
    async def send(self, chat_id, content, metadata=None):
        return {"chat_id": chat_id, "content": content, "metadata": metadata}

async def main():
    cfg = GatewayConfig(platforms={
        Platform.TELEGRAM: PlatformConfig(
            enabled=True,
            token="x",
            home_channel=HomeChannel(platform=Platform.TELEGRAM, chat_id="home123", name="Home"),
        )
    })
    router = DeliveryRouter(cfg, {Platform.TELEGRAM: DummyAdapter()})
    print(await router.deliver("hello", [DeliveryTarget.parse("telegram")]))

asyncio.run(main())

Actual output:

{'telegram': {'success': False, 'error': 'No chat ID for telegram delivery'}}

Expected behavior

  • DeliveryTarget.parse("telegram") should resolve to the configured Telegram home channel during delivery.
  • Delivery should call the adapter with chat_id="home123".

Actual behavior

  • Delivery fails with No chat ID for telegram delivery.

Suggested investigation

Resolve target.chat_id from GatewayConfig.get_home_channel(target.platform) before raising on missing chat IDs, and add a regression test that covers DeliveryTarget.parse("telegram") plus an actual DeliveryRouter.deliver() call.

extent analysis

TL;DR

The issue can be fixed by resolving the target.chat_id from GatewayConfig.get_home_channel(target.platform) before raising an error on missing chat IDs.

Guidance

  • Modify the _deliver_to_platform() method in gateway/delivery.py to resolve the home channel ID from the GatewayConfig before checking for a missing chat_id.
  • Add a regression test to cover the DeliveryTarget.parse("telegram") case with an actual DeliveryRouter.deliver() call to ensure the fix works as expected.
  • Review the DeliveryTarget.parse() method to ensure it correctly handles platform-only targets and returns the expected chat_id for home channel delivery.
  • Verify that the GatewayConfig.get_home_channel() method is correctly configured and returns the expected home channel ID for the given platform.

Example

def _deliver_to_platform(self, target, content):
    if target.chat_id is None:
        # Resolve home channel ID from GatewayConfig
        home_channel = self.config.get_home_channel(target.platform)
        if home_channel:
            target.chat_id = home_channel.chat_id
        else:
            raise ValueError(f"No chat ID for {target.platform} delivery")
    # Proceed with delivery using the resolved chat_id

Notes

This fix assumes that the GatewayConfig.get_home_channel() method is correctly implemented and returns the expected home channel ID for the given platform. Additional testing may be necessary to ensure the fix works correctly for all platforms and delivery scenarios.

Recommendation

Apply the workaround by modifying the _deliver_to_platform() method to resolve the home channel ID from the GatewayConfig before raising an error on missing chat IDs, as this directly addresses the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • DeliveryTarget.parse("telegram") should resolve to the configured Telegram home channel during delivery.
  • Delivery should call the adapter with chat_id="home123".

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Bug: bare platform delivery targets never resolve configured home channels [1 pull requests, 1 participants]