fix: use direct delivery for cron announce to forum topics#23841
Closed
AndrewArto wants to merge 2 commits intoopenclaw:mainfrom
Closed
fix: use direct delivery for cron announce to forum topics#23841AndrewArto wants to merge 2 commits intoopenclaw:mainfrom
AndrewArto wants to merge 2 commits intoopenclaw:mainfrom
Conversation
When a cron job targets a Telegram forum topic (delivery.to with :topic:NNN), use the direct outbound delivery path (deliverOutboundPayloads) instead of routing through the subagent announce flow. The announce flow triggers an agent turn in the target session, where the receiving agent can respond with ANNOUNCE_SKIP or NO_REPLY, silently dropping the cron output. Forum topic sessions are especially prone to this because the announce arrives via an internal webchat-like channel context, causing the target agent to treat it as already-delivered or irrelevant. This affects any cron job configured with delivery.mode='announce' and a forum topic target (e.g. to='-1003885638534:topic:562'). The cron generates its output correctly, resolves the threadId correctly, but the output never reaches the user because the intermediary agent decides to skip it. The fix: when resolvedDelivery.threadId is present, take the same direct delivery path used for structured payloads. This bypasses the agent intermediary and sends the text straight to the Telegram API with the correct message_thread_id. Fixes silent cron delivery failures for Telegram forum topic targets.
28c5faf to
13cd20a
Compare
Contributor
|
Thanks for the fix and discussion here. This has now landed on |
18 tasks
lanyasheng
added a commit
to lanyasheng/openclaw
that referenced
this pull request
Mar 2, 2026
…ummarization The announce flow routes cron output through a subagent turn that may summarize, truncate, or silently drop content via ANNOUNCE_SKIP/NO_REPLY. This affects all channel types (Discord channels, Telegram chats, etc.), not just forum topics. PR openclaw#23841 partially fixed this for forum topics by checking threadId, but regular channel targets still go through the announce flow and receive summarized output instead of the full cron result. This change makes all cron announce deliveries use the direct outbound path, ensuring users receive the complete output verbatim. Fixes: openclaw#13812
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.
Problem
Cron jobs targeting Telegram forum topics (e.g.
delivery.to = "-1003885638534:topic:562") silently fail to deliver their output to the user.Root Cause
For text-only cron output, the delivery path goes through the subagent announce flow (
runSubagentAnnounceFlow→sendSubagentAnnounceDirectly), which triggers a full agent turn in the target session. The receiving agent is given the option to respond withANNOUNCE_SKIP(orNO_REPLY), and it frequently does — silently dropping the cron output.Forum topic sessions are especially prone to this because:
channel=webchatin logs)ANNOUNCE_SKIPoption in the announce prompt and decides to stay silentReproduction
delivery.mode = "announce"targeting a Telegram forum topic:{ "delivery": { "mode": "announce", "channel": "telegram", "to": "-1003885638534:topic:562" } }parseTelegramTargetcorrectly extractschatIdandmessageThreadId✓resolveDeliveryTargetcorrectly setsthreadId: 562andthreadIdExplicit: true✓resolveCronAnnounceSessionKeycorrectly resolves to the forum topic session ✓sendSubagentAnnounceDirectlytriggers an agent turn where the agent respondsANNOUNCE_SKIP[agent:nested] session=...topic:562 channel=webchat ANNOUNCE_SKIPFix
When
resolvedDelivery.threadIdis present (indicating a forum topic or thread target), use the direct outbound delivery path (deliverOutboundPayloads) — the same path already used for structured payloads (media, etc.). This bypasses the intermediary agent turn entirely and sends the text straight to the Telegram API with the correctmessage_thread_id.Changes
src/cron/isolated-agent/run.ts: AddeduseDirectDeliverycondition that includesthreadIdpresenceisolated-agent.direct-delivery-forum-topics.test.ts— verifies direct delivery for forum topics and confirm announce flow still used for non-threaded targetsTest Results
All 219 cron tests pass (36 test files).
Greptile Summary
This PR fixes a bug where cron job outputs targeting Telegram forum topics (or other threaded channels) were silently failing to deliver. The root cause was that text-only cron output went through the subagent announce flow, which triggered an agent turn in the target session. The receiving agent would often respond with
ANNOUNCE_SKIPorNO_REPLY, silently dropping the cron output.The fix introduces a
useDirectDeliveryflag that triggers direct delivery (bypassing the announce flow) when either:threadId(forum topics, Discord threads, Slack threads) - new behaviorThis ensures forum topic deliveries go straight to the channel API with the correct
message_thread_id, avoiding the intermediary agent turn entirely.Changes:
src/cron/isolated-agent/run.ts:667-668to check forthreadIdpresence in addition to structured contentthreadIdis presentConfidence Score: 5/5
!= null) to handle both null and undefined while preserving valid falsy values like 0. The implementation properly passesthreadIdthrough the existingdeliverOutboundPayloadspath, which already handles threading for multiple channels (Telegram, Discord, Slack). Test coverage is comprehensive, including both the new forum topic scenario and verification that non-threaded targets still use the announce flow. All 219 cron tests pass.Last reviewed commit: 28c5faf
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!