Skip to content

Bug: No retry mechanism when run produces zero-diff or truncated output #1393

@sauravbhattacharya001

Description

@sauravbhattacharya001

Bug Description

When a run produces zero files changed (on a task that clearly requires changes) or a truncated response, the action completes as-is with no retry attempt. The workflow finishes 'successfully' with a useless result.

Reproduction

  1. Trigger claude-code-action on a task like 'refactor this module' or 'fix these 3 bugs'
  2. Run produces a PR comment but changes 0 files, or only partially addresses the task
  3. Action reports success. No retry. Workflow ends.

Expected Behavior

When the output is clearly degenerate (zero diff on a mutation task, response truncated mid-sentence), the action should retry automatically — or at minimum expose the failure signal so the workflow can retry.

Actual Behavior

Single attempt. Zero diff. Green check. Done.

Impact

  • Wastes entire CI cycles — you get notified of 'success' but nothing happened
  • Especially bad for cron-triggered runs where nobody is watching
  • Manual re-trigger costs time and breaks automation chains

Frequency

Approximately 10-15% of runs in my setup produce partial/empty results that would benefit from retry.

Suggested Fix

Optional quality thresholds with automatic retry:

\\yaml

  • uses: anthropics/claude-code-action@v1
    with:
    min_files_changed: 1
    max_retries: 2
    fail_on_empty_diff: true
    fail_on_truncated: true
    \\

This pairs with #1392 (output validation as detection) — validation detects, retry acts.

I run 16 automated agent jobs daily and have built retry/quality logic for exactly this problem. Happy to contribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-requestp3Minor bug or general feature request

    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