Problem
When a long-running background Bash task completes, the shell auto-triggers a foreground Soul run to process its results.
If this LLM request fails with APITimeoutError 3 times in a row, the shell permanently stops listening for background completions:
_MAX_BG_AUTO_TRIGGER_FAILURES = 3
This creates a hard stop.
As a result:
- A test running overnight completes successfully.
- The LLM request to analyze the results times out, often due to large accumulated output/context.
- After 3 timeouts, Kimi never retries.
- The user comes back to find
Request timed out spam and zero progress, even though the task finished hours ago.
Root Cause
From source analysis, in src/kimi_cli/ui/shell/__init__.py, the main loop does:
if bg_auto_failures >= _MAX_BG_AUTO_TRIGGER_FAILURES:
result = await idle_events.get()
At this point, the shell only waits for manual/user idle events and no longer listens for background completions.
There is no time-based recovery. Once 3 failures occur, the only way to resume is manual user input.
Suggested Fix
Add a cooldown timer.
After hitting the max failures, stop auto-triggering for a configurable duration, for example 10 minutes, then reset the counter and resume listening:
_BG_FAILURE_COOLDOWN_S = 600 # 10 minutes
Example logic:
if bg_auto_failures >= _MAX_BG_AUTO_TRIGGER_FAILURES:
if time.monotonic() - bg_last_failure_time > _BG_FAILURE_COOLDOWN_S:
bg_auto_failures = 0
result = await bg_watcher.wait_for_next(idle_events)
else:
result = await idle_events.get()
This matches the behavior of other agentic CLIs, such as Claude Code's periodic progress checks.
Environment
kimi-cli version: 1.41.0
- OS: Windows 10/11
- Model:
kimi-for-coding / k2.6
Workaround
We applied the above patch locally and confirmed that it works.
The patch is minimal, around 6 lines changed, and does not affect normal operation.
Problem
When a long-running background Bash task completes, the shell auto-triggers a foreground Soul run to process its results.
If this LLM request fails with
APITimeoutError3 times in a row, the shell permanently stops listening for background completions:This creates a hard stop.
As a result:
Request timed outspam and zero progress, even though the task finished hours ago.Root Cause
From source analysis, in
src/kimi_cli/ui/shell/__init__.py, the main loop does:At this point, the shell only waits for manual/user idle events and no longer listens for background completions.
There is no time-based recovery. Once 3 failures occur, the only way to resume is manual user input.
Suggested Fix
Add a cooldown timer.
After hitting the max failures, stop auto-triggering for a configurable duration, for example 10 minutes, then reset the counter and resume listening:
Example logic:
This matches the behavior of other agentic CLIs, such as Claude Code's periodic progress checks.
Environment
kimi-cliversion:1.41.0kimi-for-coding/k2.6Workaround
We applied the above patch locally and confirmed that it works.
The patch is minimal, around 6 lines changed, and does not affect normal operation.