[Feat] One forum topic per task in Topics-enabled Telegram supergroups#54
Open
daniel-lxs wants to merge 1 commit into
Open
[Feat] One forum topic per task in Topics-enabled Telegram supergroups#54daniel-lxs wants to merge 1 commit into
daniel-lxs wants to merge 1 commit into
Conversation
Telegram has no threads in plain chats, but Topics-enabled supergroups do. When a task launches outside any topic in a forum chat, the bot now creates a forum topic named after the request: the job's communicationThreadId points at it, the started card (Follow/Cancel) posts inside it, worker replies re-anchor to the in-topic card, and follow-ups typed in the topic queue to the job — the chat's topic list becomes a task list, Slack-thread style. A pointer reply with an "Open topic" deep link is left next to the launch message so the topic is discoverable. - TelegramCommunicationProvider.createForumTopic (needs bot admin with the manage-topics right); chat schema gains is_forum. - launchTelegramTask creates the topic at launch; launches from inside an existing topic stay there; creation failure (plain groups, missing rights) falls back to the main chat rather than dropping the task. chatIsForum is threaded through routing confirmation (pending state + auto-confirm). - Mock harness: forumTopics state + createForumTopic route, and forum semantics enforced (topic-less thread ids in forum chats 400 like real Telegram). Verified live end-to-end through the mock harness against the dev stack: mention in General -> Yes on the routing card -> topic created, started card in the topic, Open-topic pointer in General, cancel from the in-topic card (cloud job canceled with communicationThreadId = topic id). 201 tests pass across the telegram/mcp/communication suites. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Reviewing the PR now. Follow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Telegram has no threads in plain chats — but Topics-enabled supergroups do, and all our plumbing was already thread-aware (
message_thread_id→communicationThreadId). This turns that on: when a task launches outside any topic in a forum chat, the bot creates a forum topic named after the request and moves the task's life there.communicationThreadIdpoints at the new topic, so follow-ups typed in the topic queue to the job and worker replies land there (they re-anchor to the in-topic started card).Behavior boundaries
Setup required (per group, one-time)
Create a group → enable Topics in group settings → add the bot as admin with "Manage topics". Same install-shaped setup as a Slack workspace.
Changes
TelegramCommunicationProvider.createForumTopic;is_forumon the chat schema.launchTelegramTasktopic creation + reply re-anchoring (setLatestInboundMessageId) + pointer message;chatIsForumthreaded through routing-confirmation pending state and auto-confirm.forumTopicsstate,createForumTopicroute, and real-Telegram forum semantics (unknownmessage_thread_idin a forum chat 400s;createForumTopicon a non-forum chat 400s).Testing
developbase (isolated worktree)."fix the flaky login test in the web app"created, started card posted inside it, Open-topic pointer in General, task canceled from the in-topic card (cloud job 85:communicationThreadId = 3, canceled).Docs
.agent-guidance/features/telegram-integration.md(inbound flow + parity notes) and themock-telegram-testingscenario catalog (new scenario 6, harness forum semantics).🤖 Generated with Claude Code