Skip to content

Tool error messages leak to chat even when agent has already replied via message tool #11111

@gamer-mitsuha

Description

@gamer-mitsuha

Problem

When an agent uses the message tool (e.g., message send) to deliver replies progressively during a multi-step workflow, and finishes with NO_REPLY (to avoid duplicate replies), the system treats the turn as having no user-facing reply (hasUserFacingReply = false).

If any tool call failed during that turn — even an intermediate step that was subsequently retried and succeeded — the system appends a raw error message like:

⚠️ 🛠️ Exec: `ghswitch gamer-mitsuha && cd ~/.openclaw/workspace && git push` failed: zsh:1: command not found: ghswitch

This confuses users because:

  1. The agent already delivered a proper response via message send
  2. The failed tool call may have been an intermediate step that was retried successfully
  3. The raw error format looks like a system dump, not a user-friendly message

Root Cause

In the reply delivery logic, the lastToolError handler checks hasUserFacingReply — but replies sent via the message tool are not counted as user-facing replies. Only direct assistant text content counts.

The NO_REPLY / SILENT_REPLY token correctly suppresses duplicate replies but also makes the system think nothing was sent, triggering the error fallback.

Expected Behavior

If the agent has successfully delivered messages via message send (or similar tools) during the current turn, the system should consider that a reply was delivered and not append raw tool errors.

Alternatively, provide a configurable option to control tool error display behavior.

Suggested Solutions

Option A (Minimal): Add a config option:

{
  "agents.defaults.toolErrorDisplay": "auto" | "always" | "never"
}
  • auto (default): Current behavior
  • always: Always show tool errors
  • never: Never show tool errors to users (log only)

Option B (Smarter): Track whether message send (or similar delivery tools) succeeded during the current turn. If so, set hasUserFacingReply = true even if the final assistant response is NO_REPLY.

Option C (Quick fix): Allow NO_REPLY to suppress tool error messages as well, or add a variant like NO_REPLY_SILENT that also suppresses error fallbacks.

Environment

  • OpenClaw version: 2026.2.4 (git install)
  • Channel: Discord
  • Agent config: verboseDefault: "off", blockStreaming: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions