openclaw - 💡(How to fix) Fix Feature Request: Cancel/Undo window for incoming messages [1 comments, 2 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#51456Fetched 2026-04-08 01:10:59
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Participants
Timeline (top)
commented ×1mentioned ×1subscribed ×1
  • Similar to Gmail's "Undo Send" feature
  • Discord bots built from scratch can implement this easily, but OpenClaw's gateway pipeline processes messages before the agent sees them, making agent-side implementation impossible
  • Currently no message:inbound or message:pre-process hook event available

Root Cause

  • Similar to Gmail's "Undo Send" feature
  • Discord bots built from scratch can implement this easily, but OpenClaw's gateway pipeline processes messages before the agent sees them, making agent-side implementation impossible
  • Currently no message:inbound or message:pre-process hook event available
RAW_BUFFERClick to expand / collapse

Feature Request: Cancel/Undo Window for Incoming Messages

Submitted by: @jardysuntan

Problem

When a message is accidentally sent to the bot (typo, wrong channel, premature send), there is no way to cancel it before the agent starts processing. This is especially costly with expensive models like Opus where an accidental message triggers a full inference cycle.

Proposed Solution

Add a brief cancel window (2-3 seconds) after a message is received, before the agent begins processing. During this window, the user can cancel the request.

Possible implementations:

  1. Discord reaction button — gateway adds a ⛔ reaction or component button to the incoming message. If tapped within the window, message is dropped.
  2. Config-based debounce with cancel keywordmessages.inbound.cancelWindowMs: 3000 + sending "cancel" or "nvm" within that window drops the pending message.
  3. Hook event — expose a message:pre-process hook event that allows custom logic (delay, confirmation, cancel UI) before the message enters the agent session.

Use Cases

  • Accidental sends (fat-fingered, wrong channel)
  • Message sent to wrong bot/agent
  • Realizing mid-send that the prompt needs editing
  • Cost control — prevent unnecessary expensive model invocations

Context

  • Similar to Gmail's "Undo Send" feature
  • Discord bots built from scratch can implement this easily, but OpenClaw's gateway pipeline processes messages before the agent sees them, making agent-side implementation impossible
  • Currently no message:inbound or message:pre-process hook event available

Environment

  • OpenClaw 2026.2.23
  • Discord channel integration
  • Model: anthropic/claude-opus-4-6

extent analysis

Fix Plan

To implement a cancel window for incoming messages, we will use a combination of Discord API and custom logic. We will add a "cancel" reaction to the incoming message and remove the message from the processing queue if the reaction is added within the specified time window.

Implementation Steps

  • Add a Discord reaction to the incoming message using the Discord API:
import discord
from discord.ext import commands

# Add reaction to the message
async def add_reaction(message):
    await message.add_reaction('⛔')
  • Create a custom event to listen for the reaction and cancel the message processing:
# Create a custom event to listen for the reaction
@bot.event
async def on_reaction_add(reaction, user):
    if reaction.emoji == '⛔':
        # Remove the message from the processing queue
        await cancel_message_processing(reaction.message)
  • Implement the cancel_message_processing function to remove the message from the queue:
# Implement the cancel_message_processing function
async def cancel_message_processing(message):
    # Remove the message from the queue
    queue.remove(message)
    # Send a confirmation message to the user
    await message.channel.send('Message cancelled')
  • Set up a timer to remove the reaction after the specified time window:
# Set up a timer to remove the reaction
async def remove_reaction_after_timeout(message):
    await asyncio.sleep(3)  # 3 seconds
    await message.clear_reactions()

Verification

To verify that the fix worked, test the following scenarios:

  • Send a message to the bot and add the "cancel" reaction within the time window. The message should be removed from the processing queue.
  • Send a message to the bot and do not add the "cancel" reaction within the time window. The message should be processed as usual.
  • Send a message to the bot and add the "cancel" reaction after the time window. The message should not be removed from the processing queue.

Extra Tips

  • Make sure to handle errors and exceptions properly to avoid crashes or unexpected behavior.
  • Consider adding a confirmation message to the user after cancelling the message processing.
  • You can adjust the time window to a different value based on your specific requirements.

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