Description
cao launch fails with new-session: command too long when the agent profile has a context file (system prompt) larger than ~2KB.
Reproduction
# Create an agent with a context file >2KB (e.g., code_supervisor built-in)
cao install code_supervisor --provider kiro_cli
cao launch --agents code_supervisor --headless --auto-approve "hello"
Error:
cli_agent_orchestrator.clients.tmux - ERROR - Failed to create session cao-xxxxx: new-session: command too long
Environment
- CAO: latest main (installed 2026-05-18)
- tmux: 3.6
- OS: Debian 13 (Linux 6.x)
- Provider: kiro_cli
Root Cause
TmuxClient.create_session() passes environment= to libtmux server.new_session(). When the environment dict includes large values (agent profile content, system prompt), the total command exceeds tmux's argument buffer limit (~2048 bytes on Linux).
Suggested Fix
Don't pass the agent system prompt via tmux session environment. Instead:
- Create the tmux session with minimal environment
- After session is created, inject the prompt via
send_keys or a temp file that the provider reads on startup
Workaround
Use shorter context files (<2KB) or invoke the provider CLI directly without CAO.
Description
cao launchfails withnew-session: command too longwhen the agent profile has a context file (system prompt) larger than ~2KB.Reproduction
Error:
Environment
Root Cause
TmuxClient.create_session()passesenvironment=tolibtmux server.new_session(). When the environment dict includes large values (agent profile content, system prompt), the total command exceeds tmux's argument buffer limit (~2048 bytes on Linux).Suggested Fix
Don't pass the agent system prompt via tmux session environment. Instead:
send_keysor a temp file that the provider reads on startupWorkaround
Use shorter context files (<2KB) or invoke the provider CLI directly without CAO.