v0.4: Core Channel Reliability [PARTIAL]¶
Implementation Status¶
- [x] Telegram, WhatsApp, Discord, Email, and Slack channel files exist.
- [x]
BaseChannel._handle_message()normalizes inbound text/media basics and enforcesallow_from. - [x]
ChannelManagersupervises channel restarts and retries outbound sends. - [x] Tests cover reconnects, ported channel config, bridge token auth, CLI bridge login, and multimodal outbound basics.
- [x] Shared channel capability flags exist for core channels.
- [x] Normalized media envelope types exist and enrich legacy media paths.
- [x] Shared delivery result/error contracts exist.
- [x] Long-message splitting is implemented through channel capability limits.
- [x]
ChannelManagernow normalizes send failures throughDeliveryResult. - [x] Discord DM/thread session mapping metadata exists.
- [ ] Channel-specific delivery error reporting still needs richer diagnostics.
Goal¶
Make daily channels solid before adding more channels.
User Outcome¶
WhatsApp, Telegram, and Discord should feel dependable enough for daily use: media works, commands work, errors are understandable, and reconnects do not silently lose state.
Scope¶
- Harden WhatsApp media send/receive.
- Add WhatsApp QR/login status command.
- Keep owner-only admin command policy.
- Improve bridge restart handling.
- Improve outbound routing.
- Make local-file and sandbox errors clear.
- Bring Telegram media parity closer to WhatsApp.
- Add Telegram group/DM policy and Markdown-safe responses.
- Improve Discord attachment replies, reconnect behavior, and session mapping.
- Add shared channel capability flags, message splitting, media envelopes, and delivery error reporting.
Module Targets¶
backend/agent/g_agent/channels/whatsapp.pybackend/agent/g_agent/channels/telegram.pybackend/agent/g_agent/channels/discord.pybackend/agent/g_agent/channels/base.pybackend/agent/bridge/backend/agent/tests/test_whatsapp_channel.pybackend/agent/tests/test_telegram_channel.pybackend/agent/tests/test_discord_channel.py
Acceptance Criteria¶
- [x] Each core channel has a text command path.
- [x] Media receive creates usable path references for supported channels.
- [x] Channel reconnects are supervised and retryable.
- [x] Media send failures are classified through shared delivery error codes.
- [x] Channel capability flags are available through channel instances.
- [x] Long messages split safely per channel.
Tests¶
- Command routing works for each core channel.
- Media envelope normalization works.
- Message splitting respects channel limits.
- Delivery errors are surfaced.
- Owner allowlist blocks unauthorized users.
- Discord DM/thread mapping is stable.
References¶
- Nanobot channel updates.
- Hermes gateway release notes.
Agent Handoff¶
Current G-Agent State¶
BaseChannel._handle_message()already normalizes inbound messages and enforcesallow_from.ChannelManageralready supervises channel restarts and retries outbound sends.- Telegram, WhatsApp, Discord, Email, and Slack channel files already exist.
channels/capabilities.py,channels/media.py, andchannels/errors.pynow provide the first shared channel contract slice.- Existing tests:
test_channel_reconnect.py,test_ported_channels.py,test_bridge_token_auth.py,test_cli_bridge_login.py,test_multimodal_outbound.py,test_channel_contracts.py. - WhatsApp uses the Node bridge under
backend/agent/bridge/; do not replace it without a separate bridge migration plan.
Reference Details To Inspect¶
nanobot-ref/nanobot/channels/telegram.pynanobot-ref/nanobot/channels/discord.pynanobot-ref/nanobot/channels/whatsapp.pyhermes-agent-ref/gateway/platforms/telegram.pyhermes-agent-ref/gateway/platforms/discord.pyhermes-agent-ref/gateway/platforms/whatsapp.py- Hermes tests around group gating, document handling, media download retry, formatting, reconnect, and unauthorized behavior.
Implementation Strategy¶
Add shared channel contracts first, then improve individual channels.
Recommended new shared types:
channels/capabilities.py: flags likesupports_media_send,supports_media_receive,supports_buttons,supports_typing,max_text_chars,parse_mode.channels/media.py: normalized media envelope with path/url, mime, filename, size, hash, channel metadata.channels/errors.py: delivery error types.
Implementation Slices¶
- Add deeper WhatsApp media delivery diagnostics.
- Add richer Telegram group/topic policy tests.
- Preserve code blocks and links more intelligently across split boundaries.
- Improve media send/receive tests.
- Especially local file path and sandbox/allowed path errors.
- Telegram formatting safety.
- Add Markdown/HTML escape helper tests.
- Discord reconnect/thread mapping.
- Keep session key stable for DM/thread contexts.
Tests To Add Or Extend¶
test_channel_contracts.pytest_whatsapp_media_delivery.pytest_telegram_formatting.pytest_discord_session_mapping.py- Extend
test_multimodal_outbound.py.
Guardrails¶
- Do not add Feishu/Weixin/QQ/Microsoft Teams to core just because references have them.
- Do not make channel reliability depend on Web UI.
- Keep owner allowlist behavior strict.
- Keep outbound retry idempotency from
ChannelManager.
First PR Boundary¶
Channel capabilities + media envelope + tests. Then channel-specific hardening PRs for WhatsApp, Telegram, and Discord separately.