Problem
When launching a session with cao launch (non-headless), tmux attach-session is called immediately after the session is created, before kiro CLI TUI has finished initializing its input handler.
This causes keystrokes to be silently dropped — the TUI appears responsive visually but does not accept any input. The issue is most noticeable on agents with many MCP servers (longer init time).
Root Cause
In cli/commands/launch.py, the non-headless path does:
if not headless:
subprocess.run(["tmux", "attach-session", "-t", terminal["session_name"]])
The headless path already uses wait_until_terminal_status(IDLE/COMPLETED, timeout=120) before sending a message, but the non-headless path has no equivalent wait.
When the user attaches while kiro is still initializing, tmux resizes the pty and kiro's input handler ends up in a broken state.
Fix
Add wait_until_terminal_status before tmux attach-session in the non-headless path:
if not headless:
wait_until_terminal_status(
terminal["id"],
{TerminalStatus.IDLE, TerminalStatus.COMPLETED},
timeout=120,
)
subprocess.run(["tmux", "attach-session", "-t", terminal["session_name"]])
Related
Problem
When launching a session with
cao launch(non-headless),tmux attach-sessionis called immediately after the session is created, before kiro CLI TUI has finished initializing its input handler.This causes keystrokes to be silently dropped — the TUI appears responsive visually but does not accept any input. The issue is most noticeable on agents with many MCP servers (longer init time).
Root Cause
In
cli/commands/launch.py, the non-headless path does:The headless path already uses
wait_until_terminal_status(IDLE/COMPLETED, timeout=120)before sending a message, but the non-headless path has no equivalent wait.When the user attaches while kiro is still initializing, tmux resizes the pty and kiro's input handler ends up in a broken state.
Fix
Add
wait_until_terminal_statusbeforetmux attach-sessionin the non-headless path:Related
Initializing...phase, which makes this wait reliable