Skip to content

fix(cron): disable jobs whose channel cannot deliver - #137

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

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

Conversation

@cursor

@cursor cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

Bug and impact

A cron job aimed at a channel that cannot deliver (unknown name, Telegram/Discord/WebChat left disabled, or the cron channel itself) still ran the full agent. cron_send then failed, ack was skipped, and next_run stayed in the past, so the same model turn and its tools ran again on every poll. That repeats shell, file, and hardware side effects until the job is deleted.

Root cause

cron_create_job stored any channel string. cron_poll offered the due row, handle_message called agent_run, and only then did cron_send notice the target channel was missing.

Fix

  • Create time returns -2 when the channel has no send path. The cron tool and POST /api/cron report channel cannot deliver.
  • Poll time disables an already stored row (cron_job_set_enabled, not a toggle) before the agent runs, and logs the job id and channel.
  • A registered cli job still fires.

Validation

test_unregistered_channel_is_not_delivered failed before the fix (poll returned the ghost job) and passes after it. ./build/test_cron and ./build/test_dispatch pass.

Open in Web聽View Automation聽

A cron row aimed at a missing channel ran the agent, then cron_send failed
and skipped ack, so next_run stayed due and the same tools ran on every poll.
Reject that channel at create time and disable an already stored row before
agent_run.

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