skip to content

In OpenClaw, how do the queue modes steer, followup, collect and interrupt handle messages that arrive while an agent run is active?

level: middleimportance: must knowfreq 10%

answer

  1. four modes, one default
  2. messages.queue.mode and byChannel
  3. per-session /queue override wins
  4. collect folds into one turn
  5. cap 20, drop summarize

basics

~20 s

The default steer mode injects a mid-run message into the active run; followup queues each message for its own later turn; collect merges queued messages into one later turn; interrupt aborts the active run and answers the newest message.

solid answer

~40 s

The queue mode decides what a normal message does when its session already has an active run. `steer`, the default, injects it into the running turn at the next runtime boundary, or waits for the run to end if the runtime cannot accept steering. `followup` queues each message for its own later turn; `collect` merges queued messages into one followup turn after a quiet window; `interrupt` aborts the active run and runs the newest message. The mode resolves from a per-session `/queue` override, then `messages.queue.byChannel.<channel>`, then `messages.queue.mode`, then `steer`. The queue holds at most `cap` messages (20 by default), and the default `drop: "summarize"` keeps compact summaries of dropped entries. Separately, `messages.inbound.debounceMs` can batch rapid messages into one turn before any run starts.

code

json · 14 lines
json
{
  "messages": {
    "queue": {
      "mode": "steer",
      "cap": 20,
      "drop": "summarize",
      "byChannel": { "discord": "collect" },
      "debounceMsByChannel": { "discord": 1000 }
    },
    "inbound": {
      "byChannel": { "whatsapp": 2000 }
    }
  }
}

go deeper

for a junior

Name the four modes and the default, steer, and say in one line what each does with a message that arrives mid-run.

for a middle

Explain the precedence chain from a session /queue override down to the default, the cap and drop options, and how inbound debouncing differs from queue debouncing.

for a senior

Diagnose a confusing reply after a burst of messages by asking which mode resolved for that chat, whether inbound batching applied, and whether the cap forced drops.

for a principal

Decide per channel which mode the install standardizes on, trading the responsiveness of steering against the cost and clarity of one turn per message or one collected turn.

## The problem the queue solves An OpenClaw agent run can take seconds or minutes: model calls, tool calls, sometimes compaction. People do not wait politely. A typical case is someone who sends "book the train", then "actually the 9:40", then "and a window seat" while the agent is still working on the first message, and then gets a reply that answers only part of it. What happens to messages two and three is decided by the **queue mode**. OpenClaw serializes inbound auto-reply runs through a small in-process queue so two runs never collide on the same session. The queue mode decides what a normal message does when its session **already has an active run**. ## The four modes | Mode | What a mid-run message does | | --- | --- | | `steer` (default) | Injected into the active run at the next runtime boundary, when the runtime can accept steering; otherwise it waits for the run to end | | `followup` | Not steered; each message is queued for its own later turn | | `collect` | Not steered; queued messages are merged into a **single** followup turn after a quiet window | | `interrupt` | The active run is aborted and the newest message runs | Applied to the three-message example: - **`steer`**: messages two and three join the running turn. In the built-in runtime each steered input still gets its own answer, in order. - **`followup`**: the first run finishes, then two more turns run, one per message. - **`collect`**: the first run finishes, then one combined turn answers both late messages. Messages aimed at different channels or threads drain individually so replies are routed correctly. - **`interrupt`**: each arrival aborts the run in progress, so earlier work can be cut off and the newest message is the one that gets answered. ## Where the mode comes from OpenClaw resolves the mode in this order, first match wins: 1. An inline or stored per-session `/queue` override. 2. `messages.queue.byChannel.<channel>`. 3. `messages.queue.mode`. 4. The default, `steer`. In chat, `/queue collect` stores the mode for the current session; options can ride along, as in `/queue collect debounce:0.5s cap:25 drop:summarize`; and `/queue default` or `/queue reset` clears the override. ## Cap, drop and debounce A queue that only grows would be a problem, so three options bound it: - **`cap`**: the maximum queued messages per session, default `20`. - **`drop`**: what happens past the cap. `summarize` (default) drops the oldest entries but keeps compact summaries and injects them as a synthetic followup prompt; `old` drops the oldest without summaries; `new` rejects the newest message. - **debounce**: a built-in 500 ms quiet window before queued followups or collect batches drain, adjustable per channel with `messages.queue.debounceMsByChannel`. `cap` and `drop` are global or per-session options, not per-channel config keys. ## A different knob: inbound debouncing `messages.inbound.debounceMs` acts **before** a run exists. It batches rapid text-only messages from the same sender in one conversation into a single agent turn after a quiet window: - media and attachments flush immediately; - control commands bypass it; - Telegram batches ordinary text after 300 ms by default, while other channels have no generic delay unless configured; - `messages.inbound.byChannel.<channel>` overrides the global value, and `0` disables ordinary batching. If the user's three messages arrive within that window, they become one turn and the queue mode never matters. If the first message has already started a run, the queue mode decides. ## Choosing a mode - Keep **`steer`** for direct chats where people correct themselves mid-task. - Use **`collect`** for busy group channels, where many short messages should produce one considered answer. - Use **`followup`** when every message must get its own complete turn. - Use **`interrupt`** sparingly, where only the latest instruction matters and partial work can be thrown away. ## Common mistakes - **Expecting a channel setting to beat a chat command.** A `/queue` override stored for a session wins over every `messages.queue` key, so a forgotten `/queue interrupt` in one chat explains behaviour the config file does not. - **Tuning the wrong debounce.** If messages should become one turn before anything starts, the knob is `messages.inbound`; the queue debounce only matters once a run is already active. - **Assuming queued input survives everything.** Input accepted through `chat.send` is stored before the Gateway acknowledges it, but the in-memory queue is not replayed after a Gateway stop; such input shows as interrupted and needs an explicit resend.

  • In OpenClaw, what happens when more than 20 messages pile up for one busy session?
    The default `cap` of 20 is reached and the `drop` policy applies. With the default `summarize`, the oldest queued entries are dropped but compact summaries are kept and injected as a synthetic followup prompt. `drop: "old"` drops the oldest without summaries, and `drop: "new"` rejects the newest message. Both `cap` and `drop` are global or per-session settings, not per-channel keys.
  • How does `messages.inbound.debounceMs` differ from the queue's own debounce in OpenClaw?
    Inbound debouncing runs before any agent run exists: it batches rapid text-only messages from one sender in one conversation into a single turn, flushing media immediately and letting control commands bypass it. Telegram uses 300 ms by default; other channels have no generic delay unless configured. The queue's 500 ms debounce applies later, to draining queued followup and collect messages while a run is active.

  • Messages sent while the agent is busy are dropped until it finishes.
  • The default queue mode is followup, so every message gets its own turn.
  • Collect mode merges messages from different channels into one reply.
  • A byChannel queue setting overrides a /queue command sent in that chat.
  • Queue cap and drop can be set separately for each channel.