openclaw - 💡(How to fix) Fix Feature request: Announce-mode prompt guard for cron jobs [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56115Fetched 2026-04-08 01:44:47
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

Option A: Warn on save (lightweight)

Reject cron add/edit with an error if an announce-mode prompt contains sendMessage/threadTs patterns.

Root Cause

No validation at the platform level when saving or executing an announce-mode cron prompt. The prompt can contain structurally impossible instructions (sendMessage, threadTs, "post a headline then thread reply") without any warning.

Fix Action

Fix / Workaround

Current Workaround

Code Example

⚠️  Warning: This job uses announce delivery, but the prompt references 'sendMessage'/'threadTs'.
    In announce mode, the agent has no messaging tool access. Output is posted as a single message.
    Consider removing these instructions from the prompt.

---

[System: This cron runs in ANNOUNCE mode. Your entire output will be posted as a single message.
You have no Slack/messaging API access. Do not attempt sendMessage, threadTs, or headline+thread patterns.]
RAW_BUFFERClick to expand / collapse

Problem

When a cron job uses delivery.mode = "announce", the agent's output becomes a single top-level message posted by the platform. The agent has no Slack API access in this mode — announce delivery suppresses messaging tool sends (docs).

However, nothing prevents a cron prompt from instructing the agent to "use Slack sendMessage + threadTs to post a headline, then a thread reply." The agent attempts to follow these instructions, produces headline+thread-formatted output, and the platform dumps it all as one flat message.

This caused 5 incidents over 4 days in our deployment (Mar 24–27, 2026), each requiring manual diagnosis and prompt rewrites.

Root Cause

No validation at the platform level when saving or executing an announce-mode cron prompt. The prompt can contain structurally impossible instructions (sendMessage, threadTs, "post a headline then thread reply") without any warning.

Proposed Solution

Option A: Warn on save (lightweight)

When openclaw cron add/edit saves an announce-mode job whose prompt references sendMessage/threadTs/thread-reply patterns, emit a CLI warning:

⚠️  Warning: This job uses announce delivery, but the prompt references 'sendMessage'/'threadTs'.
    In announce mode, the agent has no messaging tool access. Output is posted as a single message.
    Consider removing these instructions from the prompt.

Option B: Auto-inject context (recommended)

When executing an announce-mode cron, automatically prepend a system-level note to the agent's context:

[System: This cron runs in ANNOUNCE mode. Your entire output will be posted as a single message.
You have no Slack/messaging API access. Do not attempt sendMessage, threadTs, or headline+thread patterns.]

Injected by the runtime, not the user prompt — impossible to forget.

Option C: Reject on save (strictest)

Reject cron add/edit with an error if an announce-mode prompt contains sendMessage/threadTs patterns.

Recommendation

Option B is the most robust — doesn't rely on users writing correct prompts, doesn't break existing jobs, just ensures the agent always knows its delivery context. Option A is a good complement for catching bad prompts early.

Current Workaround

Manual prefix on all announce-mode cron prompts + audit script. Works but relies on the operator remembering — the same class of fix that failed 4 times before.

Environment

  • OpenClaw 2026.3.24 (cff6dc9)
  • 19 cron jobs, 13 in announce mode
  • Slack channel delivery

extent analysis

Fix Plan

To address the issue, we will implement Option B: Auto-inject context. This involves modifying the cron job execution code to prepend a system-level note to the agent's context when running in announce mode.

Steps:

  • Modify the cron_job_executor function to check if the delivery mode is set to "announce".
  • If so, prepend the system-level note to the agent's context before executing the job.
  • Update the documentation to reflect the new behavior.

Example Code:

def cron_job_executor(job):
    if job.delivery_mode == "announce":
        # Prepend system-level note to agent's context
        context = "[System: This cron runs in ANNOUNCE mode. Your entire output will be posted as a single message.\nYou have no Slack/messaging API access. Do not attempt sendMessage, threadTs, or headline+thread patterns.]\n" + job.context
        # Execute the job with the updated context
        execute_job(job, context)
    else:
        # Execute the job as usual
        execute_job(job, job.context)

Verification

To verify that the fix worked, create a new cron job with the "announce" delivery mode and a prompt that references sendMessage or threadTs. The system-level note should be prepended to the agent's context, and the job should execute without attempting to send messages or create threads.

Extra Tips

  • Consider implementing Option A: Warn on save as a complementary measure to catch bad prompts early.
  • Review existing cron jobs and update their prompts to remove any references to sendMessage or threadTs in announce mode.
  • Monitor the system for any issues related to the new behavior and adjust the implementation as needed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING