fix(announce): preserve threadId in subagent announce for Telegram DM topics#52824
fix(announce): preserve threadId in subagent announce for Telegram DM topics#52824Lukavyi wants to merge 1 commit into
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 pull request has been automatically marked as stale due to inactivity. |
|
Thanks for the context here. I did a careful shell check against current Current main already preserves requester thread IDs for subagent completion announces and has regression coverage for stale Telegram topic session entries; the remaining PR-only logging change is diagnostic and does not justify keeping this stale branch open. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the current-main implementation and close this obsolete branch; any desired Telegram sendMessage success-log thread suffix should be tracked as a separate observability cleanup. Do we have a high-confidence way to reproduce the issue? Yes. The current-main source and regression test show the reported route shape: Telegram captures chat target and thread separately, and stale session threadId is overridden by the requesterOrigin threadId during announce delivery. Is this the best way to solve the issue? No for merging this PR as-is. Current main already solves the user-visible delivery bug in the refactored announce path, while this stale branch still changes an older file shape and its logging suffix would be misleading after threadless fallback. Security review: Security review cleared: The PR diff only touches announce routing, Telegram success logging, and tests; it does not change dependencies, workflows, permissions, secrets, package resolution, or artifact execution. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 06056926a099; fix evidence: commit 06056926a099, main fix timestamp 2026-05-04T13:39:23-07:00. |
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