fix(orch): lower inline-prompt cap below tmux's command-length limit#61
Merged
Conversation
A reviewer session failed to launch with 'command too long': its ~17KB opening prompt was passed inline as a tmux/SSH command argument and blew tmux's command-length cap. The externalize-to-file threshold was 32KB — set against the kernel's ~128KB MAX_ARG_STRLEN — but that's the wrong limit: tmux's own cap is far lower. Measured on the prod SSH box, a remote 'tmux new-session' starts failing between 12KB and 16KB of total command, so a 17KB prompt sailed under 32KB and straight into the failure. Lower maxInlinePromptBytes to 8KB so the assembled command (agent flags + the --mcp-config JSON + the prompt) stays well under tmux's cap; larger prompts are written to a file and replaced by a short bootstrap, exactly as before — just triggered at a safe size now. Managers ran fine inline because their prompts sat under tmux's limit; large reviewer/follow-up prompts (which carry a diff) are the ones that cross it, and those now externalize.
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.
Bug (prod)
A reviewer session failed to start:
The opening prompt (~17KB: a reviewer's preamble + the diff to review) was passed inline as a tmux command argument and blew tmux's command-length cap.
Why the existing guard missed it
orcha already moves oversized prompts to a file (
externalizeLargePrompt), but the threshold was 32KB, chosen against the kernel's ~128KBMAX_ARG_STRLEN. That's the wrong limit — the binding constraint is tmux's own command-length cap, which is far lower. Measured on the prod SSH box:So tmux caps out ~12–16 KB, and a 17 KB prompt sailed under the 32 KB threshold straight into the failure.
Fix
Lower
maxInlinePromptBytesto 8 KB. The assembled command (agent flags + the--mcp-configJSON + the prompt) then stays well clear of tmux's cap; anything larger is written to a file and replaced by a short bootstrap (cat <path>to read it) — the exact mechanism that already existed, just triggered at a safe size.Managers were fine inline because their prompts sit under tmux's limit; it's the large reviewer/follow-up prompts (which carry a diff) that cross it, and those now externalize. Covered by the existing
TestExternalizeLargePrompt_OffloadsToFileWhenBig(usesmaxInlinePromptBytes+1, so it tracks the new value). Full suite + vet green.Open PRs now
#60 (submodule skip) and this one.