Skip to content

[bug] new-session: command too long — agents with large context files fail to launch #242

@filhocf

Description

@filhocf

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:

  1. Create the tmux session with minimal environment
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions