Skip to content

Conversation

@diegomrsantos
Copy link
Member

@diegomrsantos diegomrsantos commented Oct 22, 2025

Issue Addressed

Fixes workflow hanging indefinitely during Claude Code Action execution.

Proposed Changes

Added safety measures to the claude-pr-review.yml workflow:

  1. Timeout Protection (timeout-minutes: 15):

    • Prevents workflow from running indefinitely
    • Terminates the step after 15 minutes if it hangs
  2. Debug Logging (ACTIONS_STEP_DEBUG: true):

    • Enables detailed debug output for troubleshooting
    • Helps diagnose where the action hangs

Additional Info

Observed Behavior:

  • First workflow run: ✅ Completes successfully
  • Subsequent runs: ❌ Hangs at "Setting up Claude Code..." step

With these changes, the workflow will fail fast (15 minutes) instead of hanging, and provide detailed logs to identify the issue.

Comment on lines 86 to +88
- name: Run Claude Code Action
if: steps.check.outputs.is_member == 'true'
timeout-minutes: 15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow Changes: Good additions

The timeout-minutes: 15 and ACTIONS_STEP_DEBUG: true are sensible additions for preventing workflow hangs and debugging issues. These align with the PR description.

- Add 15-minute timeout to prevent infinite hangs
- Enable ACTIONS_STEP_DEBUG for more detailed logging
- Helps diagnose why workflow hangs at 'Setting up Claude Code' step
@diegomrsantos diegomrsantos force-pushed the fix/claude-pr-review-timeout branch from 3fb56b2 to b7973b3 Compare October 22, 2025 20:02
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@sigp sigp deleted a comment from claude-code-actions-sigp bot Oct 22, 2025
@diegomrsantos diegomrsantos marked this pull request as draft October 22, 2025 20:10
@diegomrsantos diegomrsantos marked this pull request as ready for review October 22, 2025 20:10
@claude-code-actions-sigp
Copy link

claude-code-actions-sigp bot commented Oct 22, 2025

Claude finished @diegomrsantos's task —— View job


Code Review Complete

Todo List:

  • Read the modified workflow file
  • Compare changes with base branch
  • Review against code quality criteria
  • Post comprehensive review feedback

Review Summary

This PR adds two important safety features to the claude-pr-review.yml workflow. The changes are minimal, targeted, and address a real operational issue (workflow hanging indefinitely).

Changes Made:

  • Added timeout-minutes: 15 to the "Run Claude Code Action" step (line 88)
  • Added ACTIONS_STEP_DEBUG: true environment variable (line 90)

Detailed Analysis

1. Code Quality ✅

  • Clean and minimal: The changes are focused and don't introduce unnecessary complexity
  • Proper placement: Both additions are correctly positioned within the step definition
  • Follows GitHub Actions conventions: Standard YAML syntax and GitHub Actions best practices

2. Timeout Value Consideration ⚠️

The 15-minute timeout is reasonable for most PR reviews, but consider:

Potential issue: For large PRs with extensive changes, 15 minutes might be insufficient for Claude Code to:

  • Clone and analyze the entire codebase
  • Perform comprehensive reviews across multiple files
  • Generate detailed inline comments

Recommendation: Monitor timeout occurrences after deployment. If legitimate reviews are being cut short, consider:

  • Increasing to 20-30 minutes
  • Making timeout configurable via workflow inputs
  • Adding timeout duration to the PR description template for visibility

Current assessment: 15 minutes is a good starting point for fail-fast behavior while debugging the hang issue.

3. Debug Logging Implementation ✅

ACTIONS_STEP_DEBUG: true is the correct approach for enabling debug logging in GitHub Actions. This will:

  • Provide detailed output from the action's execution
  • Help identify where hangs occur
  • Not interfere with production functionality (logging only)

Note: Debug logs can be verbose. Once the hang issue is resolved, consider making this conditional (e.g., via workflow input or only when claude-recheck label is present).

4. Security ✅

No security concerns. The changes:

  • Don't expose secrets or sensitive data
  • Don't modify permissions
  • Don't introduce new external dependencies

5. Testing Considerations

Manual testing required: These changes need real-world validation:

  • Verify timeout triggers correctly after 15 minutes
  • Confirm debug logs provide useful information
  • Test that timeout doesn't prematurely kill valid long-running reviews

No automated tests needed: GitHub Actions workflow configuration changes typically don't have unit tests.

6. Documentation

Missing: Consider adding a comment in the workflow file explaining the timeout rationale:

- name: Run Claude Code Action
  if: steps.check.outputs.is_member == 'true'
  # 15-minute timeout to prevent indefinite hangs (see issue #XXX)
  timeout-minutes: 15
  env:
    # Enable debug logging to diagnose hanging issues
    ACTIONS_STEP_DEBUG: true

This helps future maintainers understand why these values were chosen.

Additional Observations

  1. Root cause investigation: While these changes add safety measures, they don't fix the underlying hang issue. After this PR merges, continue investigating why subsequent runs hang at "Setting up Claude Code..."

  2. Consider adding: If hangs persist, you might want to add workflow-level timeout as a safety net:

    jobs:
      claude-pr-review:
        timeout-minutes: 20  # Workflow-level timeout
  3. Monitoring: After deployment, track:

    • How often the timeout triggers
    • Whether debug logs reveal the hang location
    • If 15 minutes is adequate for typical PRs

Conclusion

Approval recommendation: ✅ Approve with minor suggestions

The changes are sound and address the immediate problem effectively. The suggestions above are enhancements, not blockers. This PR delivers exactly what it promises: fail-fast behavior and debugging capability.


@diegomrsantos
Copy link
Member Author

I tried a workaround to make the review run again: change the PR to draft and then to ready again. In my operator dg PR, it didn't work. The job was stuck for hours in "Setup claude" https://github.com/sigp/anchor/actions/runs/18719488501. But in this PR the trick worked.

@diegomrsantos
Copy link
Member Author

diegomrsantos commented Oct 22, 2025

So I tried the trick once again in the other PR and seems it fails immediately if there's another one running https://github.com/sigp/anchor/actions/runs/18719488501/job/53387663631. Or maybe it was just a coincidence

@diegomrsantos
Copy link
Member Author

diegomrsantos commented Oct 22, 2025

So I tried the trick once again in the other PR and seems it fails immediately if there's another one running https://github.com/sigp/anchor/actions/runs/18719488501/job/53387663631. Or maybe it was just a coincidence

Actually it did work in the second time #692 (comment), I was checking the previous job that got cancelled after 6 hours

@diegomrsantos diegomrsantos requested a review from dknopik October 24, 2025 11:27
@mergify mergify bot added the queued label Nov 5, 2025
mergify bot added a commit that referenced this pull request Nov 5, 2025
@mergify mergify bot merged commit 6118010 into sigp:unstable Nov 5, 2025
19 checks passed
@mergify mergify bot removed the queued label Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants