Skip to content

fix(cron): disable messaging tool when delivery.mode is none#21896

Merged
Takhoffman merged 1 commit intoopenclaw:mainfrom
lailoo:fix/cron-delivery-none-messaging-tool-21808
Feb 28, 2026
Merged

fix(cron): disable messaging tool when delivery.mode is none#21896
Takhoffman merged 1 commit intoopenclaw:mainfrom
lailoo:fix/cron-delivery-none-messaging-tool-21808

Conversation

@lailoo
Copy link

@lailoo lailoo commented Feb 20, 2026

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:

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: falsedisableMessageTool: 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

  • New test: resolves mode=none with requested=false and no channel (#21808)
  • All 176 existing cron tests pass
  • Lint passes (oxlint --type-aware: 0 warnings, 0 errors)
  • 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 Summary

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.

Confidence Score: 5/5

  • 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.

Last reviewed commit: 13d6a62

Copy link
Contributor

@arosstale arosstale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct diagnosis and fix. deliveryRequested is false when mode=none, which left the messaging tool enabled — the agent could still send directly to the channel. The one-line change disables the tool for both cases. Test validates the delivery plan shape is correct.

@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Feb 28, 2026
@Takhoffman Takhoffman force-pushed the fix/cron-delivery-none-messaging-tool-21808 branch from 13d6a62 to 87ccc36 Compare February 28, 2026 17:11
@Takhoffman Takhoffman force-pushed the fix/cron-delivery-none-messaging-tool-21808 branch from 87ccc36 to b22e04a Compare February 28, 2026 17:12
@Takhoffman Takhoffman merged commit d7d3416 into openclaw:main Feb 28, 2026
9 checks passed
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Feb 28, 2026
* main: (31 commits)
  fix(browser): resolve correct targetId in navigate response after renderer swap (openclaw#25326)
  fix: sed escaping and UID mismatch in Podman Quadlet setup (openclaw#26414)
  fix(cron): pass heartbeat target=last for main-session cron jobs (openclaw#28508) (openclaw#28583)
  fix(cron): disable messaging tool when delivery.mode is none (openclaw#21808) (openclaw#21896)
  fix: clear delivery routing state when creating isolated cron sessions (openclaw#27778)
  fix(cron): avoid marking queued announce paths as delivered (openclaw#29716)
  fix(cron): enable completion direct send for text-only announce delivery (openclaw#29151)
  fix(cron): force main-target system events onto main session (openclaw#28898)
  fix(cron): condition requireExplicitMessageTarget on resolved delivery (openclaw#28017)
  feat(cron): add --account flag for multi-account delivery routing (openclaw#26284)
  fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs (openclaw#19541)
  fix: sandbox browser docker no-sandbox rollout (openclaw#29879) (thanks @Lukavyi)
  GitHub: add regression bug issue template and routing (openclaw#29864) thanks @Takhoffman
  feat(feishu): add chat info/member tool (openclaw#14674)
  feat(feishu): add markdown tables, positional insert, color_text, and table ops (openclaw#29411)
  feat(feishu): add parent/root inbound context for quote support (openclaw#18529)
  fix: land android onboarding and voice reliability updates (openclaw#29796)
  fix(android-voice): rotate playback token per assistant reply
  fix(android-voice): retry talk config after transient failures
  fix(android-voice): cancel in-flight speech when speaker muted
  ...
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
tuyunlei added a commit to tuyunlei/openclaw that referenced this pull request Mar 1, 2026
Resolved conflicts:
- CHANGELOG.md: take upstream release notes
- extensions/feishu/src/{channel,reply-dispatcher,send}.ts: take upstream
  (community replyInThread impl supersedes ours, PR openclaw#27325)
- src/agents/compaction.ts: merge timing logs with upstream
  identifier preservation + buildCompactionSummarizationInstructions
- src/agents/pi-extensions/compaction-safeguard.ts: merge timing logs
  with upstream summarizationInstructions param
- src/cron/isolated-agent/run.ts: merge upstream requireExplicitMessageTarget
  condition (openclaw#28017) + disableMessageTool none-mode (openclaw#21896) with our
  ownerNumbers + senderIsOwner additions

Post-merge fixes:
- Restore DEFAULT_CONTEXT_TOKENS import in attempt.ts (auto-merge dropped it)
- Adjust memory flush test to match our cache-stable systemPrompt design
  (flush instructions in user prompt, not extraSystemPrompt)
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron delivery.mode=none still delivers to Telegram

3 participants