Skip to content

[bug-hunter] pr-comment.sh exits silently when --severity/--title/--why value is missing #1879

Description

@github-actions

Impact

claude-workflows/pr-review/scripts/pr-comment.sh can exit with status 1 and no error output when a required flag value is omitted (for --severity, --title, or --why). This makes PR review automation fail without actionable diagnostics, increasing triage/debug time for users and maintainers.

Reproduction Steps

  1. Save and run this new minimal failing test:
#!/usr/bin/env bash
set -euo pipefail

repo_root="/home/runner/work/ai-github-actions/ai-github-actions"
script="$repo_root/claude-workflows/pr-review/scripts/pr-comment.sh"

tmp_out="$(mktemp /tmp/gh-aw/agent/pr-comment-test-out.XXXXXX)"
tmp_err="$(mktemp /tmp/gh-aw/agent/pr-comment-test-err.XXXXXX)"

set +e
PR_REVIEW_REPO="elastic/ai-github-actions" \
PR_REVIEW_PR_NUMBER="1" \
bash "$script" "README.md" "1" --severity >"$tmp_out" 2>"$tmp_err"
rc=$?
set -e

if [[ $rc -eq 0 ]]; then
  echo "Expected non-zero exit for missing --severity value, got success"
  exit 1
fi

# Failing assertion: parser should emit actionable error text, but currently emits nothing.
if [[ ! -s "$tmp_err" ]]; then
  echo "FAIL: stderr is empty; expected actionable error message for missing --severity value"
  exit 1
fi

if ! grep -q "Error:" "$tmp_err"; then
  echo "FAIL: stderr missing 'Error:' prefix"
  cat "$tmp_err"
  exit 1
fi

echo "PASS"
  1. Execute it:
chmod +x /tmp/gh-aw/agent/test_pr_comment_missing_value.sh
/tmp/gh-aw/agent/test_pr_comment_missing_value.sh

Expected vs Actual

Expected: Script exits non-zero and prints an actionable error message indicating a missing value for --severity (similarly for --title/--why).

Actual: Script exits non-zero with empty output.

Observed output:

FAIL: stderr is empty; expected actionable error message for missing --severity value

Failing Test

/tmp/gh-aw/agent/test_pr_comment_missing_value.sh (full script shown above) fails deterministically.

Evidence

Suggested Actions

  • Add explicit missing-value checks for --severity, --title, and --why in argument parsing before shift 2.
  • Add a small regression test/script asserting non-empty actionable stderr for missing flag values.

What is this? | From workflow: Trigger Bug Hunter

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

  • expires on Aug 28, 2026, 11:19 AM UTC

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