Skip to content

fix(gateway): resolve Telegram/channel message processing crash#36

Open
veithly wants to merge 1 commit intomasterfrom
fix/telegram-session-key-mismatch
Open

fix(gateway): resolve Telegram/channel message processing crash#36
veithly wants to merge 1 commit intomasterfrom
fix/telegram-session-key-mismatch

Conversation

@veithly
Copy link
Contributor

@veithly veithly commented Mar 16, 2026

Summary

  • Root cause: ChannelManager._handle_message() passes session_key to AgentLoop.process() and process_with_thinking() for per-user session isolation, but these methods did not accept the parameter — causing a TypeError that silently crashed every message attempt
  • Adds session_key: str | None = None parameter to both process() and process_with_thinking() methods
  • Implements automatic session switching when a different key is provided, enabling proper multi-user/multi-channel session isolation

Impact

All channel messaging was broken (Telegram, Discord, Feishu, etc.) since the agent could never successfully process any inbound message. Every message resulted in:

TypeError: process() got an unexpected keyword argument 'session_key'

This was caught by the generic error handler in the bus, returning "Sorry, an unexpected error occurred" to all users.

Test plan

  • Start gateway with Telegram channel enabled: spoon-bot gateway
  • Send a message from Telegram — verify bot responds
  • Send messages from different Telegram users/chats — verify session isolation
  • Test with think mode enabled to verify process_with_thinking() path

Made with Cursor

ChannelManager._handle_message() passes session_key to the agent's
process() and process_with_thinking() methods for multi-user session
isolation, but these methods did not accept the parameter — causing a
TypeError that silently crashed every message processing attempt.

This broke all channel messaging (Telegram, Discord, etc.) since
the agent could never process any inbound message.

Adds optional session_key parameter to both methods with automatic
session switching when a different key is provided.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant