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
- 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"
- 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
- Parser branches assign from
$2 and immediately shift 2 without checking argument count:
claude-workflows/pr-review/scripts/pr-comment.sh#L73-L84
set -e is enabled:
claude-workflows/pr-review/scripts/pr-comment.sh#L35
- With a trailing flag missing its value (e.g.,
--severity), shift 2 fails and exits before any user-friendly validation/error path.
- Related historical context reviewed:
Suggested Actions
What is this? | From workflow: Trigger Bug Hunter
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
Impact
claude-workflows/pr-review/scripts/pr-comment.shcan 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
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:
Failing Test
/tmp/gh-aw/agent/test_pr_comment_missing_value.sh(full script shown above) fails deterministically.Evidence
$2and immediatelyshift 2without checking argument count:claude-workflows/pr-review/scripts/pr-comment.sh#L73-L84set -eis enabled:claude-workflows/pr-review/scripts/pr-comment.sh#L35--severity),shift 2fails and exits before any user-friendly validation/error path.Suggested Actions
--severity,--title, and--whyin argument parsing beforeshift 2.What is this? | From workflow: Trigger Bug Hunter
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.