Skip to content

Agent cannot react to messages: messageId not exposed in inbound context #17651

@assada

Description

@assada

Problem

The system prompt instructs the agent to react to messages (especially in reactionLevel: "extensive" mode), but the agent has no way to obtain the messageId of the triggering message.

Current behavior

  1. reactionLevel: "extensive" adds guidance: "React whenever it feels natural"
  2. The message tool react action requires messageId (required parameter)
  3. inbound_meta JSON (built by buildInboundMetaSystemPrompt in inbound-meta.ts) does not include message_id
  4. Agent calls message react → fails with "messageId required"

Expected behavior

The agent should be able to react to the current/triggering message. Two possible solutions:

Option A (minimal): Expose message_id in the inbound_meta payload:

{
  "schema": "openclaw.inbound_meta.v1",
  "message_id": "12345",
  ...
}

Option B (ergonomic): Support messageId: "current" in the react action, similar to how [[reply_to_current]] resolves the current message ID internally via parseInlineDirectives.

Context

  • MessageSid is already available in TemplateContext and used internally (ack reactions via maybeSendAckReaction, reply threading via [[reply_to_current]])
  • The plumbing exists — it just needs to be surfaced to the agent tool layer
  • Affects all channels that support reactions (Telegram, Discord, Slack, WhatsApp, Signal)

Relevant code

  • src/auto-reply/reply/inbound-meta.ts — builds inbound metadata (missing message_id)
  • src/utils/directive-tags.ts — parses [[reply_to_current]] using currentMessageId
  • src/agents/tools/telegram-actions.ts:99messageId required for react
  • src/agents/system-prompt.ts — reaction guidance injected based on reactionLevel

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions