Repository navigation
fix(channels): treat an empty agent reply as delivered - #136
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Telegram, Discord, and WebChat returned -1 for an empty reply, so cron skipped the ack and reran the agent and its tools on every poll. An empty body cannot be posted, so those sends now succeed and a leftover -1 no longer blocks the ack. Co-authored-by: esadrianno <esadrianno@gmail.com>
This branch has not been deployed
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.
Bug and impact
A cron job whose agent returns an empty reply never gets acknowledged on Telegram, Discord, or WebChat.
next_runstays in the past, so every poll reruns the agent and its tools. This happens when the model returnscontent: nullor""with no tool calls, and whenmax_tool_iterationsis hit on a tool-call turn (those responses are often null). The user never receives a message, and shell and other tools repeat until the process stops.Root cause
tg_send,discord_send, andwebchat_send/ws_send_totreat an empty string as a failed send.send_then_maybe_ack_cronskipscron_ack_deliverywhenever send returns non-zero. Those platforms cannot accept an empty post, so the failure is permanent.Fix
After the address checks, an empty body returns 0 and posts nothing. If a channel still returns -1 for an empty body, dispatch still acks a successful agent turn.
Validation
tests/test_telegram.c: an empty send to a chat id returns 0; a missing chat id still failstests/test_dispatch.c: a cron job with a null model reply is acked even when send returns -1./build/test_telegram(59 tests, 0 failed)./build/test_dispatch(OK)