#21896: fix(cron): disable messaging tool when delivery.mode is none
size: XS
experienced-contributor
Cluster:
Messaging Platform Improvements
## Summary
- **Bug**: Cron jobs with `delivery.mode: "none"` still deliver output to Telegram because the agent's messaging tool remains enabled.
- **Root cause**: `disableMessageTool` in `src/cron/isolated-agent/run.ts:494` is set to `deliveryRequested`, which is `false` for mode `"none"` — the agent retains the messaging tool and can send messages on its own.
- **Fix**: Also disable the messaging tool when `deliveryPlan.mode === "none"`.
Fixes #21808
## Problem
When a cron job has `delivery: { mode: "none" }`, the `resolveCronDeliveryPlan()` function correctly returns `requested: false` (automatic delivery is suppressed). However, in `run.ts`, the `disableMessageTool` flag is derived solely from `deliveryRequested`:
```typescript
disableMessageTool: deliveryRequested, // false when mode="none"
```
This means the agent's messaging tool stays enabled. The agent can autonomously send messages to Telegram via the messaging tool, defeating the purpose of `mode: "none"`.
**Before fix:**
- `delivery.mode: "none"` → `deliveryRequested: false` → `disableMessageTool: false`
- Agent retains messaging tool → output appears in Telegram
## Changes
- `src/cron/isolated-agent/run.ts` — extend `disableMessageTool` condition to also check `deliveryPlan.mode === "none"`
- `src/cron/delivery.test.ts` — add regression test for `mode=none` delivery plan resolution
**After fix:**
- `delivery.mode: "none"` → `disableMessageTool: true`
- Agent cannot send messages → cron runs silently as intended
## Test plan
- [x] New test: `resolves mode=none with requested=false and no channel (#21808)`
- [x] All 176 existing cron tests pass
- [x] Lint passes (`oxlint --type-aware`: 0 warnings, 0 errors)
- [x] Format check passes on changed files
## Effect on User Experience
**Before:** Cron jobs with `delivery.mode: "none"` still send output to Telegram, forcing users to disable crons entirely to stop unwanted messages.
**After:** `delivery.mode: "none"` correctly silences cron output — the agent runs but cannot send messages to any channel.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes a bug where cron jobs configured with `delivery.mode: "none"` would still send output to messaging channels (e.g., Telegram) because the agent's messaging tool was not disabled. The root cause was that `disableMessageTool` in `run.ts` was only set based on `deliveryRequested` (which is `false` for `mode: "none"`), leaving the messaging tool active for the agent to use autonomously.
- **`src/cron/isolated-agent/run.ts`**: Extended the `disableMessageTool` condition from `deliveryRequested` to `deliveryRequested || deliveryPlan.mode === "none"`, correctly silencing the agent when delivery is explicitly disabled.
- **`src/cron/delivery.test.ts`**: Added a regression test verifying that `mode=none` resolves with `requested: false` and no channel, while preserving the `to` field.
- **`CHANGELOG.md`**: Added changelog entry under Fixes.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it is a minimal, targeted bug fix with a regression test.
- The change is a single-line condition extension that correctly addresses the documented bug. The logic was verified against all three delivery modes (announce, webhook, none) and the existing delivery resolution code. The fix aligns with the existing `disableMessageTool` semantics (when true, the message tool is omitted from the agent's tool list). A regression test is included. No risk of unintended side effects.
- No files require special attention.
<sub>Last reviewed commit: 13d6a62</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16996: fix(cron): parse Telegram topic target format for announce delivery
by Glucksberg · 2026-02-15
81.2%
#13638: fix: pass delivery context to cron isolated agent subagents
by dario-github · 2026-02-10
79.6%
#6522: fix(cron): deliver original message when agent response is heartbea...
by sidmohan0 · 2026-02-01
79.6%
#23086: fix(cron): surface channel resolution error for isolated sessions w...
by hydro13 · 2026-02-22
79.5%
#13383: fix(cron): route text-only payloads through direct delivery
by Masha-L · 2026-02-10
79.5%
#11216: Fix nightly failures: cron webchat delivery result + media cleanup ...
by DeanoC · 2026-02-07
78.3%
#8097: fix: auto-convert one-shot reminders for reliable delivery
by Gerrald12312 · 2026-02-03
78.0%
#21014: fix(cron): suppress main-session summary for HEARTBEAT_OK responses
by nickjlamb · 2026-02-19
78.0%
#8307: fix(cron): improve tool description with reliable reminder guidance
by vishaltandale00 · 2026-02-03
77.6%
#19385: fix: pass authProfileId from cron session to runEmbeddedPiAgent
by gigi-trifle · 2026-02-17
76.6%