Skip to content

fix(channels): treat an empty agent reply as delivered - #136

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-identification-4cc5
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-identification-4cc5

Conversation

@cursor

@cursor cursor Bot commented Oct 19, 2026

Copy link
Copy Markdown

Bug and impact

A cron job whose agent returns an empty reply never gets acknowledged on Telegram, Discord, or WebChat. next_run stays in the past, so every poll reruns the agent and its tools. This happens when the model returns content: null or "" with no tool calls, and when max_tool_iterations is 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, and webchat_send / ws_send_to treat an empty string as a failed send. send_then_maybe_ack_cron skips cron_ack_delivery whenever 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 fails
  • tests/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)
Open in Web聽View Automation聽

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant