Skip to content

fix(orch): lower inline-prompt cap below tmux's command-length limit#61

Merged
nathanwhit merged 1 commit into
mainfrom
lower-inline-prompt-cap
Jun 24, 2026
Merged

fix(orch): lower inline-prompt cap below tmux's command-length limit#61
nathanwhit merged 1 commit into
mainfrom
lower-inline-prompt-cap

Conversation

@nathanwhit

Copy link
Copy Markdown
Owner

Bug (prod)

A reviewer session failed to start:

failed to start session: tmux new-session -d -s orcha-... claude --mcp-config {...} <17KB prompt>:
exit status 1: Connection to 144.202.18.40 closed. command too long

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 ~128KB MAX_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:

total command result
12 KB OK
16 KB FAIL ("command too long")

So tmux caps out ~12–16 KB, and a 17 KB prompt sailed under the 32 KB threshold straight into the failure.

Fix

Lower maxInlinePromptBytes to 8 KB. The assembled command (agent flags + the --mcp-config JSON + 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 (uses maxInlinePromptBytes+1, so it tracks the new value). Full suite + vet green.

Open PRs now

#60 (submodule skip) and this one.

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.
@nathanwhit nathanwhit merged commit 401a25d into main Jun 24, 2026
1 check 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