Kiro does not wait for command completion
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues
Operating System
win32
Kiro Version
0.9.2
Bug Description
When running commands, particularly long running commands, kiro does not wait for command completion and spams commands into the shell (which causes both issues with commands and spurious consumption of credits).
This behavior occurs even when steering files specifically direct the agent to only issue one command at a time and wait for completion.
Steps to Reproduce
- Create a steering file at
.kiro/steering/development.md:
---
inclusion: always
---
## Important: Running Tools
- When you run tools you MUST WAIT FOR THEM TO COMPLETE.
- Do not issue any other commands until it returns.
- ALWAYS FOLLOW THIS RULE, no exceptions.
- Create a slow Python script
slow_task.py:
import time
import sys
print("Starting task...")
sys.stdout.flush()
for i in range(10):
time.sleep(1)
print(f"Progress: {i+1}/10")
sys.stdout.flush()
print("Task completed successfully!")
- Ask Kiro: "Run slow_task.py and tell me when it completes"
Expected Behavior
Execute: uv run python slow_task.py
[WAIT 10+ seconds for completion]
[Read output]
[Respond to user]
Actual Behavior (Bug)
Execute simultaneously:
- uv run python slow_task.py
- dir
- type output.log
- [other random commands]
Result: Commands interrupt each other, Exit Code: -1, broken session
Key Observations
- Kiro makes parallel tool calls even when steering explicitly forbids it
- Commands with
Exit Code: -1indicate interrupted/incomplete execution - The bug occurs regardless of how strongly the steering file is worded
- Happens with pytest, python scripts, and any command taking >2 seconds
- Kiro will even make unnecessary tool calls (like
listDirectory) at conversation start for no reason
Impact
- Shell sessions break
- Test suites get interrupted mid-run
- Cannot get reliable command output
- Steering file instructions are completely ignored
Expected Behavior
Kiro should never blindly enter commands into a shell, particularly where there's a command running.
When instructed to wait for command completion in a steering file, it MUST respect that instruction.
Conversation ID
edb2818b-52a7-4d41-bac3-23e93cac1f17 40652dfe-21cf-4707-8bf2-61a2c80a00a2 660efe53-ad93-44dc-b0db-c63c5c81bdbb 95f2e10d-2f91-40cb-ba38-c77f0903b501 68c2a612-566b-4cb3-af06-927702cc88fd
Additional Context
No response
🤖 Potential Duplicate Detected
This issue appears to be similar to:
- #5376: Bug Report: execute_bash Tool Blocking All Commands (85% similar)
- #4893: Bug: Duplicate parallel responses on single submission (85% similar)
- #4813: the ai cant follow the instructions in there hook (85% similar)
- #4731: Double execution and double credits used (85% similar)
- #4011: Kiro chat agent cannot read output from commands (85% similar)
What happens next?
- ⏰ This issue will be automatically closed in 3 days
- 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
- 💬 Comment on the original issue if you have additional information
Why is this marked as duplicate? Both issues report problems with command execution tools - the new issue describes Kiro not waiting for command completion and spamming commands, while #5376 reports the execute_bash tool blocking all commands. Both involve fundamental problems with command execution behavior in Kiro.
Thank you for your feedback! 🙏
The 👎 reaction has been noted. The duplicate label has been removed and this issue has been sent back for maintainer review.
A maintainer will review this issue shortly.
I also see this behaviour, seems like the agent is timing out prematurely for some long running tasks. Most common example I see is when running large E2E test suites during task execution. Not sure how the shell integration works, but could be something like a sub-process/sub-execution interval timeout?
I am experiencing the same issue as well.
Currently, the IDE in Kiro does not properly wait for commands to fully finish before continuing with the next step.
For example, when executing relatively simple tasks such as compiling an application, the system only waits around 5–10 seconds before assuming the process has completed. After that, it attempts to execute additional commands or apply new actions even while the previous process is still running.
This behavior causes inconsistent executions, overlapping processes, and incorrect results, especially for tasks that require longer compilation times, dependency installation, or artifact generation. Ideally, the IDE should detect when a process has actually completed (based on the exit code or completion state) before continuing with the next automated action.
Additionally, this behavior prevents users from being able to run autonomous actions without constantly monitoring the terminal output and manually helping the agent by providing the execution result themselves. This significantly reduces the reliability and autonomy of the agent workflow.
Not fixed yet...
So interestingly, and for another issue after updating kiro to 1.0.337, I think I've finally fixed/worked around this issue.
I predominately use wsl terminals on windows and noticed that none of the terminals had shell integration working. Kiro appears to support shell extensions for 'bash', 'pwsh', 'zsh' or 'fish'.
Kiro sets TERM_PROGRAM=kiro in its Windows process environment, but this doesn't cross the Windows→WSL boundary via WSLENV. Without TERM_PROGRAM, the shell integration script (which provides OSC 633 command boundary markers) never loads. Without shell integration, the harness can't detect when a command starts/ends or what its exit code is — causing it to not wait for completion and always report Exit Code: 1 (or -1).
Fix (user-side workaround):
-
Set
WSLENVat the Windows user level (PowerShell, one-time):[System.Environment]::SetEnvironmentVariable("WSLENV", "TERM_PROGRAM/u", "User") -
Add to
~/.bashrc:[[ "$TERM_PROGRAM" == "kiro" ]] && . "$(wslpath "$(kiro --locate-shell-integration-path bash)")" -
Kill existing Kiro terminals / reload window.
After doing this, it seems to have worked nicely on long running tests...
On the Linux/bash side of this thread (the shell-integration marker discussion): I hit that on Fedora in Kiro IDE and it's fixed for me in 1.3.11. The WSL WSLENV/TERM_PROGRAM angle looks like its own separate thing, but if you're on Linux/bash and an older build, worth updating and seeing if the "doesn't wait / exit -1" behaviour clears up.