Skip to content

Fix ACP prompt overflow on Windows#149

Open
HToTH wants to merge 2 commits intoaiming-lab:mainfrom
HToTH:fix/windows-acp-long-prompt
Open

Fix ACP prompt overflow on Windows#149
HToTH wants to merge 2 commits intoaiming-lab:mainfrom
HToTH:fix/windows-acp-long-prompt

Conversation

@HToTH
Copy link

@HToTH HToTH commented Mar 23, 2026

Summary

Fixes a Windows-specific ACP failure where Stage SYNTHESIS and other long-context stages could fail with an error
equivalent to "The command line is too long".

The issue was not token exhaustion. It was caused by prompt text being passed inline through the ACP CLI on Windows.

Root cause

On Windows, acpx often resolves to an npm-installed .cmd launcher such as acpx.CMD.

That launcher goes through cmd.exe, which has a much smaller practical command-line limit than the normal Windows
process limit. As a result, prompts that were still below the previous inline threshold could still fail before the
existing fallback logic had a chance to help.

What changed

  • Keep the existing fallback-to-file behavior for oversized ACP prompts
  • Add a stricter inline prompt limit on Windows when the resolved ACP launcher is a .cmd or .bat wrapper
  • Continue using file-based prompt transport automatically once that safer limit is exceeded
  • Add regression tests for:
    • oversized prompts switching to file transport before inline execution
    • "command line too long" failures falling back to file transport
    • Windows .cmd ACP launchers using the lower safe inline limit

Why this helps

This makes ACP prompt handling match the real behavior of Windows launcher wrappers instead of assuming the higher
process-level limit is always usable.

That prevents failures in stages that assemble large literature or synthesis context, especially when using Codex
CLI / Gemini CLI through npm-installed ACP commands.

Validation

  • Reproduced the failure locally on Windows during Stage SYNTHESIS
  • Measured a failing prompt at about 17.9 KB, which was still small enough to bypass the old threshold but too large
    for the actual .cmd launcher path
  • Verified the updated logic now routes such prompts through file transport instead
  • Ran tests successfully:
.\.venv\Scripts\python.exe -m pytest tests\test_rc_llm.py -q

Result: 24 passed

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.

1 participant