Skip to content

Bug: OpenClaw CLI provider passes large web content as CLI argument (PR #165) #166

@JithendraNara

Description

@JithendraNara

Bug Description

In PR #165 (Add OpenClaw CLI provider support), the implementation passes the entire web page content as a CLI argument via --message <prompt>.

Location

The bug is in src/llm/cli.ts:

const args = [
  "agent",
  "--agent",
  model && model.trim().length > 0 ? model.trim() : "main",
  "--message",
  prompt,   // ← BUG: Entire web page content passed here!
  "--json",
  "--timeout",
  String(Math.max(1, Math.ceil(timeoutMs / 1000))),
];

Why It's a Problem

  1. Shell argument limits: Most systems cap CLI arguments at 128KB-2MB. Web pages can be 50KB-500KB+, which will cause failures
  2. No stdin support: The implementation should pass content via stdin (like other CLI tools do) instead of CLI arguments
  3. Test was flawed: The PR author's smoke test used a tiny message:
    printf 'OpenClaw summarizes through the main agent.\n' | ...
    This works, but real usage with full web pages will break

Suggested Fix

Use stdin or file input instead of CLI arguments:

Option 1: Use stdin (recommended)

const args = ["agent", "--agent", model, "-", "--json", "--timeout", ...];
// Then pass prompt via stdin in execCliWithInput

Option 2: Write to temp file

// Write prompt to temp file, then use --message-file (if supported)

Test Case

To reproduce:

  1. Summarize a large web page (>100KB of content)
  2. Observe failure due to argument size limits

Additional Notes

  • This is a great feature addition (OpenClaw support)!
  • The implementation is otherwise solid — this is just an input method issue
  • Works fine for small content, but needs fixing for production use with real web pages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions