Skip to content

Detect and retry steps that return empty results #28

@landigf

Description

@landigf

Problem

When a Claude CLI step returns an empty result (usually because Claude wrote to a file instead of returning text, or because it entered plan mode), the pipeline currently logs a warning and continues with empty output. Downstream steps that depend on this output produce garbage.

This happened in production: two crew reviewers returned empty results, but the meta-reviewer still ran and produced a synthesis of 6/8 reviews — silently incomplete.

Suggested fix

Add a requireNonEmpty option (default: true for LLM steps) that:

  1. Checks if the step result text is empty or whitespace-only
  2. If empty and retries are configured, retries the step
  3. If empty after all retries, fails the step explicitly rather than continuing with empty output
step("reviewer")
  .prompt("Review this paper...")
  .retry({ maxAttempts: 2 })
  .requireNonEmpty(true)  // fail if result is empty

The --system-prompt flag fix (issue #22) addresses the root cause for most empty results, but this provides a safety net.

Labels

bug, reliability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions