Skip to content

Fix Windows 32KB command-line limit for agent prompts#269

Open
wesm wants to merge 3 commits intomainfrom
windows-large-prompt
Open

Fix Windows 32KB command-line limit for agent prompts#269
wesm wants to merge 3 commits intomainfrom
windows-large-prompt

Conversation

@wesm
Copy link
Collaborator

@wesm wesm commented Feb 16, 2026

Summary

  • Switch copilot, cursor, droid, and opencode agents from CLI arguments to stdin piping for prompt delivery, avoiding the Windows CreateProcess 32,766-character limit
  • Switch gh pr comment from --body to --body-file - with stdin piping for the same reason
  • Add cmd.WaitDelay = 5s to all pipe-based agents (claude, codex, cursor, gemini) so context cancellation reliably terminates pipe reads when child processes outlive the parent
  • Add --large-prompt flag to check-agents for validating the fix with a 33KB+ prompt

Test plan

  • go test ./... passes
  • roborev check-agents — all agents pass
  • roborev check-agents --large-prompt — agents that support large prompts pass

Closes #266

🤖 Generated with Claude Code

wesm and others added 3 commits February 15, 2026 21:19
Four agents (copilot, cursor, droid, opencode) passed prompts as CLI
arguments, which hits the 32,766-char CreateProcess limit on Windows.
Switch all four to stdin piping. Also switch gh pr comment from --body
to --body-file - for the same reason.

Add --large-prompt flag to check-agents for validating the fix with a
33KB+ prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cursor CLI does not support stdin piping — revert to positional arg.

Add cmd.WaitDelay = 5s to all agents that use StdoutPipe (claude,
codex, cursor, gemini). When CommandContext kills a process, child
processes can keep stdout pipes open, causing pipe reads to block
forever. WaitDelay (Go 1.20+) force-closes pipes after the grace
period, preventing the hang observed with gemini under --large-prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cursor CLI does support stdin when no positional arg is given.
The earlier revert was based on a stale binary that hadn't been
rebuilt after the initial stdin change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wesm wesm force-pushed the windows-large-prompt branch from 0fc5144 to ca7299f Compare February 16, 2026 03:19
@roborev-ci
Copy link

roborev-ci bot commented Feb 16, 2026

roborev: Combined Review

Verdict: Changes are directionally good, but there are 3 Medium-severity issues to address before merge.

Medium

  1. No compatibility fallback for new stdin prompt mode

    • Refs: internal/agent/copilot.go:79, internal/agent/droid.go:98, internal/agent/opencode.go:118, internal/agent/cursor.go:107
    • Issue: These agents now send prompts via stdin without a capability/version fallback. Older or variant CLIs that require positional/flag prompt input may fail or become interactive.
    • Recommendation: Add per-agent capability detection (or version gating) and fallback to prior argument-based prompt mode when stdin prompt mode is unsupported.
  2. ClaudeAgent appears not migrated to stdin prompt handling

    • Refs: internal/agent/claude.go
    • Issue: ClaudeAgent is inconsistent with other agents and appears to still pass prompt content via command arguments, keeping process-list exposure and argument-length risk.
    • Recommendation: If supported by the Claude CLI, pipe prompt via cmd.Stdin and remove prompt text from command arguments.
  3. Some stdin-piped agents lack WaitDelay

    • Refs: internal/agent/copilot.go:85, internal/agent/droid.go:104, internal/agent/opencode.go:131
    • Issue: These subprocesses now use pipes but do not set cmd.WaitDelay, increasing hang risk if pipe closure/drain behavior is abnormal.
    • Recommendation: Set cmd.WaitDelay consistently for these agents, matching the safer pattern used elsewhere.

Synthesized from 4 reviews (agents: codex, gemini | types: security, default)

@roborev-ci
Copy link

roborev-ci bot commented Feb 16, 2026

roborev: Combined Review

Verdict: Changes are mostly positive, but there are 2 Medium-severity functional regressions to address before merge.

Medium

  1. Potential Copilot prompt delivery regression

    • File: internal/agent/copilot.go:79
    • Issue: Prompt transport was changed to stdin only, and --prompt was removed. If Copilot CLI still requires --prompt for non-interactive mode, prompts may be ignored or the process may hang waiting for interaction.
    • Suggested fix: Keep an explicit --prompt path, or add CLI capability detection/fallback between flag-based and stdin-based prompt input.
  2. Potential OpenCode invocation semantic mismatch

    • File: internal/agent/opencode.go:118
    • Issue: Code now pipes prompt via stdin and no longer passes positional message args, while comments/documented usage indicate opencode run [message..]. If message args (or explicit stdin marker) are required, behavior may regress.
    • Suggested fix: Use the CLI’s documented explicit stdin form (if supported), or retain positional prompt passing with guarded fallback for large prompts.

Notes

  • No Critical or High findings were reported.
  • Security-focused reviews reported no security vulnerabilities in this diff.

Synthesized from 4 reviews (agents: gemini, codex | types: security, default)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Large diffs fail due to 32KB CreateProcess command-line limit

1 participant