fix(announce): preserve threadId in subagent announce for Telegram DM topics#52824
Draft
Lukavyi wants to merge 1 commit intoopenclaw:mainfrom
Draft
fix(announce): preserve threadId in subagent announce for Telegram DM topics#52824Lukavyi wants to merge 1 commit intoopenclaw:mainfrom
Lukavyi wants to merge 1 commit intoopenclaw:mainfrom
Conversation
… topics (openclaw#52217) Two fixes to prevent threadId loss during subagent announce delivery: 1. Swap conversationId priority in resolveSubagentCompletionOrigin to prefer the chat-level ID from `to` over threadId, so bound-route lookups match the conversation rather than the topic thread inside it. 2. Add defensive guard in resolveAnnounceOrigin ensuring the requester's threadId (captured at spawn) is never overridden by a stale session entry threadId during the merge. Also adds message_thread_id to Telegram sendMessage log lines for observability, and three regression tests covering direct, queue, and no-thread scenarios. Closes openclaw#52217
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.
Summary
Fixes #52217 — subagent completion announce was delivering to the main Telegram DM chat instead of the originating topic because
threadIdwas lost during the announce delivery pipeline.resolveSubagentCompletionOrigin: preferto-derived chat ID overthreadIdfor bound-route lookups, so bindings match the conversation (chat) rather than the topic thread inside itresolveAnnounceOrigin: ensure the requester'sthreadId(captured at spawn time) is never overridden by a stale session entrylastThreadIdmessage_thread_idtosendMessage oklog lines for easier diagnosisTest plan
pnpm test -- src/agents/subagent-announce.format.e2e.test.ts— 73 tests pass (including 3 new)pnpm test -- src/utils/delivery-context.test.ts— 9 tests passpnpm check— all lint/format checks pass