Workflow tool: args not forwarded to script when combined with scriptPath
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:
Workflow({ scriptPath, args: {repoRoot, runId, segment: "gotchas-c"} })— fresh run- Same call +
resumeFromRunIdfrom the failed run - Fresh call again without
resumeFromRunId(ruling out resume-specific behavior) argspassed 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.