Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

[Bug] Background auto-trigger permanently stops after 3 consecutive LLM timeouts, leaving long-running tasks unproced #2193

Description

@mzjsbql-web

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions