Bug Description
The Kiro CLI provider detects IDLE prematurely during the TUI initialization phase, causing the task message to be sent before Kiro is ready to accept input. The message is lost and the session appears stuck.
Root Cause
Kiro CLI TUI renders its full layout — including the "Ask a question or describe a task" prompt placeholder — before the "● Initializing..." phase completes. The provider's get_status() matches NEW_TUI_IDLE_PATTERN against this placeholder and returns IDLE, even though Kiro cannot accept input yet.
The TUI_PROCESSING_PATTERN only checks for "Kiro is working" but has no check for "Initializing...".
Evidence from logs
Failing session (false IDLE in ~1 second):
19:43:16 - send_keys: kiro-cli chat --agent agent-ops
19:43:17 - Waiting for {idle, completed}, status: PROCESSING
19:43:18 - Waiting for {idle, completed}, status: IDLE ← false IDLE
19:43:28 - ERROR: No Kiro CLI response found - no Credits marker or green arrow detected
Successful session from same day (correct 12s PROCESSING):
08:41:50 - send_keys: kiro-cli chat --agent cloud-architect
08:41:50~08:42:02 - PROCESSING for ~12 seconds
08:42:02 - IDLE detected → success
The terminal pipe-pane log for the failing session confirms only "● Initializing..." animation frames were captured after CAO declared IDLE.
Proposed Fix
Add TUI_INITIALIZING_PATTERN to detect the initialization phase:
TUI_INITIALIZING_PATTERN = r"Initializing\.\.\."
In get_status(), check for it before the idle prompt check:
# Kiro TUI renders the idle prompt placeholder before init completes.
# Unlike "Kiro is working" (which can be stale), "Initializing..." is
# cleared once init finishes, so its presence always means not ready.
if re.search(TUI_INITIALIZING_PATTERN, clean_output):
return TerminalStatus.PROCESSING
Key difference from "Kiro is working" handling: No position-aware logic needed. "Initializing..." is always cleared by Kiro after init completes, so its presence unconditionally means PROCESSING. The "Kiro is working" ghost text can linger as stale in the buffer, which is why it uses position-aware checking.
After fix
19:55:08 - send_keys: kiro-cli chat --model claude-sonnet-4.6 --agent agent-ops
19:55:08 - PROCESSING
19:55:09 - PROCESSING ← correctly stays PROCESSING during Initializing
19:55:11 - IDLE ← real IDLE after init completed (~3s)
Environment
- CAO: latest main (commit c5bbdd1)
- Kiro CLI: v2.x TUI mode (non-legacy)
- macOS
Bug Description
The Kiro CLI provider detects IDLE prematurely during the TUI initialization phase, causing the task message to be sent before Kiro is ready to accept input. The message is lost and the session appears stuck.
Root Cause
Kiro CLI TUI renders its full layout — including the
"Ask a question or describe a task"prompt placeholder — before the"● Initializing..."phase completes. The provider'sget_status()matchesNEW_TUI_IDLE_PATTERNagainst this placeholder and returnsIDLE, even though Kiro cannot accept input yet.The
TUI_PROCESSING_PATTERNonly checks for"Kiro is working"but has no check for"Initializing...".Evidence from logs
Failing session (false IDLE in ~1 second):
Successful session from same day (correct 12s PROCESSING):
The terminal pipe-pane log for the failing session confirms only
"● Initializing..."animation frames were captured after CAO declared IDLE.Proposed Fix
Add
TUI_INITIALIZING_PATTERNto detect the initialization phase:In
get_status(), check for it before the idle prompt check:Key difference from
"Kiro is working"handling: No position-aware logic needed."Initializing..."is always cleared by Kiro after init completes, so its presence unconditionally means PROCESSING. The"Kiro is working"ghost text can linger as stale in the buffer, which is why it uses position-aware checking.After fix
Environment