ductor icon indicating copy to clipboard operation
ductor copied to clipboard

[Feature]: silent_on_success flag for cron jobs (no Telegram push when nothing useful to say)

Open Aut0-Mat opened this issue 6 months ago • 1 comments

Problem or motivation

Some scheduled cron jobs are "technical" by design and have nothing useful to push when they succeed — they only need to be heard about on failure. Examples:

  • A re-indexing job that runs nightly and just confirms "OK, indexed 5000 files"
  • A config-sync job that detects no diff between source-of-truth and live config (nothing to apply)
  • A cleanup job that finds nothing to clean

Today, cron always pushes its result to Telegram via _deliver_cron and send_rich(). There's no native way to mute success-path delivery. Result: a notification at 4am every night that wakes nobody up but pollutes the topic and adds noise to the daily scroll.

I noticed you shipped --silent for ask_agent_async.py in v0.16.0 (#86) — same conceptual need, different surface. Applying the pattern to cron would close the gap.

Proposed solution

A silent_on_success: bool = False flag on cron jobs (in the schema + --silent-on-success flag on cron_add.py / cron_edit.py). When True and last_run_status == "success", skip the Telegram push.

Backward compatible: default False preserves current behavior.

I don't know exactly where in cron/observer.py:_deliver_result the skip would live cleanly given the bus envelope structure — would you have a preferred shape?

Alternatives considered

  • Local patch on bus/cron_sanitize.py to recognize a <<NOREPLY>> sentinel in the cron output (current workaround): re-applied on every pipx upgrade, fragile. Would work as a fallback if the flag approach is too invasive, but the flag feels cleaner.
  • Mute Telegram topic notifications client-side: works for noise reduction but messages still appear in the topic scrollback.

Why this matters beyond my use case

Any user with cron jobs running during quiet hours (3–6am for indexing, cleanup, daily reset) wants no notification on success. The current behavior forces them to either accept the noise or hack the package directly.

Before submitting

  • [x] I have searched existing issues and feature requests for duplicates.

Aut0-Mat avatar May 18 '26 16:05 Aut0-Mat

Shipped in v0.18.1. silent_on_success is now a cron job field (--silent-on-success on cron_add/cron_edit, --no-silent-on-success to turn it back off). The success-path push is muted while errors are always delivered, and last_run_status is still updated. Thanks for the detailed write-up.

Release: https://github.com/PleasePrompto/ductor/releases/tag/v0.18.1

PleasePrompto avatar Jun 13 '26 05:06 PleasePrompto