fix(agent): pass acpx prompt via temp file to avoid Windows CLI length limit#334
fix(agent): pass acpx prompt via temp file to avoid Windows CLI length limit#334sridhar-3009 wants to merge 1 commit into
Conversation
…h limit acpx exec accepted the full prompt as a positional CLI argument. On Windows, CreateProcess caps the command line at 8191 characters; large prompts (diff + JSON schema + workspace preamble) are silently truncated at that boundary. The truncated text ends mid-sentence, acpx replies in prose, and no-mistakes fails to parse the expected JSON output. Fix: write the prompt to a temp file before starting the process and invoke "acpx exec -f <file>" instead. acpx has supported the -f flag on exec since at least v0.11.0 (the version reported in issue kunchenguid#315). The file is removed via defer after cmd.Wait() returns. This change is safe on all platforms: there is no prompt-size path left that could exceed OS limits. Fixes kunchenguid#315.
|
Thanks for the contribution, @sridhar-3009! One process note on this repo: PRs need to be raised through no-mistakes ( If working from a fork was the blocker, that's fixed as of v1.30.0 (#306). Per CONTRIBUTING.md: point I won't be merging PRs that bypass the gate going forward, but I'd genuinely love to land your work once it's re-raised. Thanks for understanding! 🙏 |
|
Thanks for the contribution! One process note: this repo only merges changes that come through the no-mistakes pipeline, so the required Could you re-raise it via no-mistakes? Running the pipeline on your branch (review → test → lint → docs → push) opens/updates the PR through the gate and turns that check green, making it eligible to merge. The change itself looks useful - it just needs to come through the pipeline to stay consistent with the rest of the queue. You have several open in this area, so the same applies to each. Happy to help if the gate setup gives you any trouble. |
Summary
Fixes #315.
Root cause
acpxAgent.buildArgsappended the full prompt as a positional CLI argument:On Windows,
CreateProcesscaps the entire command line at 8191 characters. Large prompts (diff + JSON schema + workspace preamble) are silently truncated at that boundary. The truncated text ends mid-sentence, so acpx responds in plain prose ("Your message looks cut off...") and no-mistakes fails to parse the expected JSON object:Short prompts work; large ones (review, document) do not.
Fix
Write the prompt to a named temp file before starting the subprocess, then invoke:
acpx has supported
exec -f <file>since at least v0.11.0 (the version in the bug report). The temp file is removed viadefer os.Removeaftercmd.Wait()returns.This change is platform-agnostic: no prompt size can exceed OS limits via args any more.
Tests
TestACPAgentBuildArgsUsesExecModeto assert trailing args are[..., "exec", "-f", "<path>"]TestACPAgentRunParsesAcpxJSONOutputshell script to log prompt file content so the assertion can still verify the prompt text reaches acpxgo test ./internal/agent/...passesTest plan
go test ./internal/agent/... -run TestACPAgent— all passgo test ./internal/agent/...— full suite passes