Skip to content

Bug: Worker Navigation Loop May Have No Exit Condition When LLM Returns Empty Responses #85

@zTgx

Description

@zTgx

Description

When the LLM returns an empty or extremely short response (< 2 characters), parse_and_detect_failure() parses it as the fallback Command::Ls (because the empty string matches the _ => Command::Ls pattern). However, the is_parse_failure check evaluates !trimmed.starts_with("ls") — an empty string does not start with "ls", so is_parse_failure = true. The worker logs a parse failure but does not consume a round (because the continue statement skips dec_round()).

If the LLM persistently returns empty responses (e.g., due to API abnormalities), the worker will enter an infinite loop until the llm_calls budget is exhausted.

Reproduction Conditions

The LLM API returns empty responses repeatedly.

Related Code

  • rust/src/agent/worker/execute.rs:234parse_and_detect_failure()
  • rust/src/agent/worker/mod.rs:220-241 — Parse failure handling and continue

Suggested Fix

Parse failures should also consume a round (or at minimum, implement a consecutive failure counter that forces a "done" state when a threshold is exceeded).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions