OpenClaw bot loop protection
How two bots are stopped from replying to each other forever, the sliding-window budget, the precedence of overrides, and which channels can enforce it
Two helpful bots in one room is a classic failure: each replies to the other, politely, forever. OpenClaw can accept messages written by other bots on channels that support the allow-bots setting, and when that path is enabled, pair loop protection prevents two bot identities from replying to each other indefinitely. Here is how the guard works, its defaults, how to set a shared baseline and narrower overrides, which channels can enforce it, and the separate budget that governs internal agent group rounds.
How the guard works
- The guard is enforced by the core inbound reply runner: each supporting channel maps its inbound event into generic facts, the account or scope, the conversation id, the sender bot id and the receiver bot id.
- Core tracks the participant pair in both directions, so A to B and B to A count as the same pair, applies a sliding-window budget, and suppresses the pair during a cooldown once the budget is exceeded.
- Defaults: enabled, twenty events per pair within a sixty-second sliding window, and a sixty-second suppression after the budget is exceeded; the guard is active whenever a channel lets bot-authored messages reach dispatch.
- It does not affect human-authored messages, single-bot deployments, self-message filtering, or bot replies that stay under the budget.
Set enabled: false only when your channel policy intentionally allows bot-to-bot conversations without automatic suppression.
Baseline and overrides
A shared baseline under the channel defaults gives every supporting channel the same window, budget and cooldown, and channels may expose narrower overrides that layer over it key by key. Precedence, narrowest first: a per-room or per-space setting when the channel supports per-conversation overrides, a per-account setting when the channel supports accounts, the channel’s top-level setting, the shared defaults, then the built-in values. The docs’ example keeps the shared budget at twenty, lowers Discord to eight with a secondary account allowing bots at five events and a ninety-second cooldown, sets a Google Chat space and a Matrix room to five, and gives Slack eight with bots allowed on mentions; Feishu deliberately uses only the shared baseline.
Channel support
- Discord uses the native author-bot fact keyed by account, channel and bot pair; Feishu the native bot sender type for admitted bot-authored group messages, keyed by account, chat and pair; Google Chat the native bot sender type keyed by account, space and pair; Matrix the configured bot accounts keyed by account, room and configured pair; and Slack the native bot id keyed by account, channel and pair.
- Channels that do not expose a reliable inbound bot identity keep using their normal self-message and access-policy filters, and the docs say they should not opt into this guard until they can identify both participants in the pair.
- Agent group threads use a separate coordinator budget for participants sharing one inbound message: qualified broadcast entries allow at most four rounds and thirty-two participant turns, rounds include the initial one, turns count agent runs started with slots reserved before parallel launch, and everyone passing, either limit or cancellation stops further turns. That in-memory budget is scoped to the channel, account, conversation, thread and root message and cannot resume after a Gateway restart; internal continuations carry distinct identities so ordinary dedupe does not suppress them, and they neither change the transport pair guard’s thresholds nor replace bot-admission and self-message policies.
OpenClaw broadcast groups is the feature whose rounds get the separate coordinator budget, and OpenClaw on Slack one of the channels that enforces the pair guard on mentions.
When to loosen it
The only reason to disable the guard is a channel policy that intentionally wants bot-to-bot conversation without suppression; otherwise tune the budget per room or account and leave the baseline on. OpenClaw on Discord is the channel with the richest override surface, and OpenClaw agent-to-agent messaging the deliberate agent-to-agent path that does not go through a chat room at all.
On Diali
On Diali the guard is on with the upstream defaults for Discord and Slack, the two connected channels that expose bot identities; WhatsApp, Telegram, SMS and voice keep their ordinary self-message and access-policy filters. Hosted OpenClaw on Diali is the assistant.
- Twenty events, sixty seconds, sixty seconds of quiet.
- A to B and B to A are one pair.
- Room beats account beats channel beats defaults.
Stop reading about it, build one
Set up an agent, pick a channel, and have it working inside the app you already keep open.
