Repository navigation
Description
Problem
On native Windows a builder can fail to start, looping forever on:
.builder-start.sh: line 23: /c/Users/<user>/.local/bin/claude: Permission denied
Agent exited (code 126). Resuming the conversation in 2 seconds...
No conversation found with session ID: ...
Agent failing immediately (code 1). Starting a fresh conversation with the original prompt...
The launch script generated in packages/codev/src/agent-farm/commands/spawn-worktree.ts passes the whole builder prompt (which inlines the issue body) and the role text as command-line arguments to the harness. Microsoft Defender inspects process command lines. When the issue text reads like a list of process-launching calls and system tool names, Defender classifies the command line as a threat and Windows refuses to create the process. Git Bash reports that refusal as "Permission denied".
Seen on 2026-11-20 spawning a PIR builder for #1911. Confirmed by:
- Defender's protection history holds one detection per relaunch, each quoting the builder command line.
- The same prompt text passed as an argument to any other program is refused the same way, from Git Bash and from PowerShell.
- The harness starts normally with short arguments, and a 20,000-character plain-text argument is accepted, so this is content, not length.
Nothing recovers on its own: the fresh launch is blocked, the resume attempt finds no session, and the script starts over. Each pass adds another severe detection to the machine's security history. Mail sent to the builder is held with busy:no-composer-marker, which points the operator at the render gate instead of the real cause.
Fix
- Keep prompt and role text off the command line. The launch script already writes
.builder-prompt.txtand.builder-role.md; hand them to the harness by file or standard input instead of expanding them into arguments. Apply this to every launch form in the script (entry, pinned, unpinned) and to each supported harness, on all platforms. Check each harness's documented options for reading a prompt and an appended system prompt from a file before choosing the mechanism. - Stop the relaunch loop when the harness cannot be started at all. Exit code 126 or 127 from the first launch is not a crashed conversation; print one clear message naming the likely causes (security software blocking the launch, harness not installed) and stop instead of retrying.
Verification
- A unit test over the generated script asserting that no launch line expands the prompt or role file into an argument.
- A manual check on native Windows: spawn a builder for Windows: bare-name user-tool spawns resolve in the cwd before PATH; turn off the current-folder lookup at process start (release blocker, removes the native-Windows preview) #1911 with Defender real-time protection on, and confirm it reaches its first turn.
- Existing spawn, resume and context-refresh paths still work on macOS/Linux (CI) and on Windows (on-demand Windows workflow, linked in the PR).
Notes
- Keep this issue's wording plain. Its body is inlined into the prompt of the builder that fixes it, so a body full of command names can hit the same block.
- Blocks Windows: bare-name user-tool spawns resolve in the cwd before PATH; turn off the current-folder lookup at process start (release blocker, removes the native-Windows preview) #1911, whose builder is stopped until this lands.
Activity