Skip to content

bug(cron): --tools csv stores space-separated string instead of array on Windows (PowerShell) #68826

@andyk-ms

Description

@andyk-ms

Bug Report

Version: 2026.4.15 (041266a)
Platform: Windows 11 (PowerShell)

Description

When passing multiple tools to --tools in cron add or cron edit on Windows/PowerShell, the gateway stores them as a single space-separated string instead of a proper array.

Root Cause

In PowerShell, an unquoted comma-separated value like exec,read,write is parsed as a PowerShell array @("exec","read","write") and passed to Node as three separate arguments. Node/Commander receives opts.tools = "exec read write" (space-joined), so opts.tools.split(",") produces ["exec read write"] — one element, no split.

This is a PowerShell-specific quoting issue. The fix is either:

  1. User-side: always quote --tools "exec,read,write" on Windows
  2. CLI-side: also split on whitespace in addition to commas: opts.tools.split(/[,\s]+/)

Option 2 is more robust and would handle both cases transparently.

Steps to Reproduce (Windows PowerShell)

# Bug: unquoted — PowerShell splits on comma before Node sees it
openclaw cron add --name test --cron "0 3 * * 0" --session isolated --model ollama/granite4:3b-h --light-context --timeout-seconds 30 --tools exec,read,write --message test
# Result: toolsAllow: ["exec read write"]  <- wrong

# Workaround: quoted
openclaw cron add --name test --cron "0 3 * * 0" --session isolated --model ollama/granite4:3b-h --light-context --timeout-seconds 30 --tools "exec,read,write" --message test
# Result: toolsAllow: ["exec", "read", "write"]  <- correct

Suggested Fix

In cron-cli, change:

opts.tools.split(",").map(...)

to:

opts.tools.split(/[,\s]+/).map(...)

This handles both quoted (exec,read,write) and space-separated PowerShell input (exec read write) transparently.

Impact

  • Jobs with multiple tools silently get no tool restrictions enforced
  • No error or warning shown — invisible at creation time
  • Workaround: quote the value --tools "exec,read,write" or manually fix ~/.openclaw/cron/jobs.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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