Skip to content

exec tool renders PowerShell output as "see in attachment" on Windows when output contains binary BOM #108802

Description

@lijustin655

Description

When using the exec tool to run PowerShell commands on Windows, if the command output contains binary content (e.g., Python stdout with a UTF-8 BOM), the Gateway renders the response as "see in attachment" instead of showing the actual output text.

This breaks the agent's ability to read and process command output directly in context.

Steps to Reproduce

  1. Run OpenClaw Gateway on Windows (Node 24.x)
  2. Execute any PowerShell command via the exec tool that produces output containing a binary BOM
  3. The tool response shows "see in attachment" rather than the plain text

Example:

python -c "print('hello')"

Current Workaround

Appending | ForEach-Object ToString to every PowerShell command:

python -c "print('hello')" | ForEach-Object ToString

But this is fragile, easy to forget, and must be applied to every exec call.

Expected Behavior

The exec tool should handle binary content or BOM-prefixed text output gracefully -- either stripping the BOM and rendering as text, or providing a configuration option to control the text vs. attachment threshold.

Environment

  • OS: Windows 10/11 (64-bit)
  • OpenClaw: latest (2026.7.x)
  • Node: v24.x
  • Shell: PowerShell
  • Python: 3.13+

Additional Context

Only occurs on Windows with PowerShell. Linux/macOS shells do not exhibit this behavior since they do not emit BOM bytes before stdout text output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions