Workflow tool: args not forwarded to script when combined with scriptPath

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 31, 2026

Workflow({ scriptPath, args }) reproducibly fails before any agents run when args
is supplied alongside scriptPath. The invoked script's own validation guard
(!args) fires, meaning args arrived as undefined even though a well-formed
JSON object was passed.

Reproduced 4/4 times, all failing in <10ms with 0 agents spawned and an identical
error, varying:

  1. Workflow({ scriptPath, args: {repoRoot, runId, segment: "gotchas-c"} }) — fresh run
  2. Same call + resumeFromRunId from the failed run
  3. Fresh call again without resumeFromRunId (ruling out resume-specific behavior)
  4. args passed as a pre-stringified JSON string (the format the tool's own

error-recovery hint suggested) — also failed identically

Script-side guard that fires:

if (!args || typeof args !== 'object' || Array.isArray(args)) {
  throw new Error(`Workflow args must be an object with an explicit args.segment. ...`)
}

Expected: args passed as a JSON object to Workflow({ scriptPath, args }) should
reach the script's args global, per the tool's own documented contract
("Pass arrays/objects as actual JSON values in the tool call, NOT as a
JSON-encoded string").

Workaround: invoke via inline script (full file contents) instead of scriptPath,
or skip the Workflow tool and run the underlying check directly via Agent/Bash/MCP calls.

View original on GitHub ↗