Skip to content

fix: Discord thread replies, Telegram thread support, and queue reliability#142

Open
geoffwellman wants to merge 5 commits intoTinyAGI:mainfrom
geoffwellman:fix/discord-threads-telegram-reliability
Open

fix: Discord thread replies, Telegram thread support, and queue reliability#142
geoffwellman wants to merge 5 commits intoTinyAGI:mainfrom
geoffwellman:fix/discord-threads-telegram-reliability

Conversation

@geoffwellman
Copy link

Summary

  • Discord: Respond to all channel messages without requiring @mention, and reply in threads instead of inline
  • Telegram: Support forum topic threads for responses, files, and typing indicators; respond in groups/supergroups
  • Queue reliability: Fix PATH resolution for spawned agent processes, add command timeout (5min), startup queue drain, and fallback polling

Changes

Discord ()

  • Remove @mention requirement for guild messages
  • Create threads from user messages; reply in existing threads
  • Route files, typing indicators, and all response chunks through the thread

Telegram ()

  • Accept messages from groups and supergroups (not just private chats and forums)
  • Pass to file attachments, typing indicators, and all commands
  • Store thread ID in pending messages for correct response routing

Queue processor ()

  • Call on startup to drain pending messages from previous session
  • Add 30-second fallback poll to catch missed events
  • Trigger after stale message recovery

Agent invocation ()

  • Add , , to spawned process PATH
  • Add 5-minute timeout with SIGTERM/SIGKILL to prevent hung agent processes

Test plan

  • Send a message in a Discord server channel without @mentioning the bot — should respond in a new thread
  • Send a message in an existing Discord thread — should reply in that thread
  • Send a message in a Telegram forum topic — should respond in the same topic
  • Send a file in a Telegram forum topic — file should appear in the topic
  • Restart tinyclaw with pending messages in the queue — should process them on startup
  • Verify agent timeout by checking logs after 5+ minutes of a stuck process

🤖 Generated with Claude Code

…bility

Discord:
- Respond to all messages without requiring @mention
- Create threads for responses in server channels
- Typing indicator targets the thread

Telegram:
- Respond in groups/supergroups (not just private chats and forums)
- File attachments sent to the correct forum topic thread
- Typing indicator targets the correct thread
- Commands (agent, team, reset, pairing) work in threads

Queue reliability:
- Fix claude not found in PATH by adding ~/.local/bin to spawn env
- Add 5-minute timeout to agent commands to prevent hung processes
- Process pending messages on startup (not just on new events)
- Add 30-second fallback poll so queue never gets stuck

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Geoff and others added 4 commits February 27, 2026 12:23
- Add ChannelRouting and ChannelConfig types to Settings
- Add resolveChannelAgent() for channel name → agent mapping
- Add parseMentionRouting() for @agent extraction from messages
- Discord: channel routing from settings, @mention priority routing,
  default_agent fallback for guild messages
- Telegram: @mention routing in groups/supergroups, topic/group name
  routing via channel_routing config, default_agent fallback
- Existing channel_routing in settings.json now functional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `timeout` field to AgentConfig (seconds, default 300)
- Add RunCommandOptions with onOutput callback for stdout streaming
- invokeAgent accepts InvokeOptions to forward onOutput to runCommand
- Queue processor sends periodic progress updates to chat every 60s
  for agents with timeout > 5min, so users know the agent is still working
- Progress messages include elapsed time and last output snippet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Threads have their own name (the thread title), not the parent
channel name. Now resolves message.channel.parent.name when in
a thread so channel_routing maps correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants