fix(windows): avoid spawn ENAMETOOLONG via prompt tail truncation#14
Merged
fix(windows): avoid spawn ENAMETOOLONG via prompt tail truncation#14
Conversation
Separates fixed CLI flags from the final prompt string so Windows can measure and truncate the prompt argument independently. Made-with: Cursor
Introduce win-cmdline-limit with pessimistic length estimation (libuv-style doubling for quoted argv) and tail-preserving prompt truncation when over budget. Load CURSOR_BRIDGE_WIN_CMDLINE_MAX (clamped 4096–32700, default 30000) into LoadedEnv and BridgeConfig. Made-with: Cursor
Run fitPromptToWinCmdline in chat and Anthropic handlers; return 500 with a clear error when the line cannot fit. Pass optional headers for JSON and SSE responses (X-Cursor-Proxy-Prompt-Truncated). Log startup cmdline budget. Made-with: Cursor
Add vitest for estimateCmdlineLength and fitPromptToWinCmdline; assert winCmdlineMax defaults and CURSOR_BRIDGE_WIN_CMDLINE_MAX clamping; extend BridgeConfig test fixture with winCmdlineMax. Made-with: Cursor
Clarify CURSOR_AGENT_NODE/SCRIPT vs ~32K cap; describe CURSOR_BRIDGE_WIN_CMDLINE_MAX and proxy behavior. Bump version to 0.6.0. Made-with: Cursor
Owner
Author
|
closes #13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Windows
CreateProcesscaps the full command line at ~32,767 characters. Passing a huge chat prompt as the final argv could still fail withspawn ENAMETOOLONGeven when usingCURSOR_AGENT_NODE+CURSOR_AGENT_SCRIPT(those only avoid cmd.exe’s ~8K limit).Changes
buildAgentFixedArgsso fixed flags are separate from the prompt.CURSOR_BRIDGE_WIN_CMDLINE_MAX(default 30000, clamped 4096–32700).X-Cursor-Proxy-Prompt-Truncated: truewhen truncated;console.warnwith lengths.Commits
Made with Cursor