Skip to content

Windows: worker system prompt via argv exceeds 32,767-char limit → bare 'spawn ENAMETOOLONG' for every lane (0/N batch) #640

Description

@HenryLach

Summary

On Windows, spawnAgent (extensions/taskplane/agent-host.ts:455) passes the composed worker system prompt as a single argv element (--system-prompt <text>). The base worker template (templates/agents/task-worker.md) is 28,497 bytes in 0.30.6; once a project's .pi/agents/task-worker.md overlay pushes the composed command line past Windows' 32,767-char CreateProcess limit, every lane fails at spawn with a bare spawn ENAMETOOLONG in the engine-worker stderr. The engine then marks the head task failed and skips its lane dependents — a 0/N batch with zero worker execution and no actionable message.

Reproduction (second occurrence)

  • 2026-09-08, batch 20260908T234433 (Penster, taskplane 0.30.6, Windows 11, node 24): 6 tasks / 3 lanes; all three lane heads Runtime V2 execution error: spawn ENAMETOOLONG; 3 failed + 3 skipped in 2m16s. Overlay was 4,433 bytes → composed argv ≈ 33.2K.
  • 2026-07-17, batch 20260717T235502 TP-101: same signature (first occurrence).

Diagnosis took the operator's supervisor a lane-log read plus a byte count; the engine log gave nothing beyond the errno.

Two asks, one issue

1. Immediate — preflight length check on win32 before spawn

In spawnAgent, on process.platform === "win32", compute the composed command-line length (execPath + cli + all args incl. --system-prompt, with Windows quoting) and, if > 32,767, fail BEFORE spawn with an actionable error, e.g.:

worker command line is 33,226 chars; Windows limit is 32,767.
System prompt = base template (28,497) + .pi/agents/task-worker.md (4,433).
Trim the overlay by ≥ 459 chars or upgrade to a build that passes the prompt via file.

Surface it as the task's failure reason (so the supervisor alert names it), not only engine stderr.

2. Real fix — do not pass the system prompt via argv

Write the composed prompt to a temp file under the batch runtime dir (or pipe via stdin) and pass --system-prompt-file <path> (or equivalent) to pi. Removes the platform limit entirely and lets the base template grow without silently eating every project's overlay headroom (today a Windows project has ~3.9K chars of overlay ceiling).

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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