Skip to content

feat: implement issue #500 — pr-review: dispatcher fails on review_requested (empty gh api URL) + agent comment runaway - #501

Merged
don-petry merged 4 commits into
mainfrom
dev-lead/issue-500-20260620-2138
Jun 21, 2026
Merged

feat: implement issue #500 — pr-review: dispatcher fails on review_requested (empty gh api URL) + agent comment runaway#501
don-petry merged 4 commits into
mainfrom
dev-lead/issue-500-20260620-2138

Conversation

@don-petry

@don-petry don-petry commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Closes #500

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • Chores
    • Enhanced the PR review workflow with improved error handling and validation checks. The workflow now detects and fails gracefully on edge cases, ensuring more reliable PR identification.

…quested (empty gh api URL) + agent comment runaway
@don-petry
don-petry requested a review from a team as a code owner June 20, 2026 21:48
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bd360639-61ed-4257-b392-e57256727701

📥 Commits

Reviewing files that changed from the base of the PR and between 0e3f498 and 53ec185.

📒 Files selected for processing (1)
  • .github/workflows/pr-review-mention-reusable.yml

📝 Walkthrough

Walkthrough

The "Resolve PR URL" step in .github/workflows/pr-review-mention-reusable.yml is refactored from a simple if/elif/else to a case-based dispatch on github.event_name. Three intermediate env vars (EVENT_NAME, PR_HTML_URL, ISSUE_PR_API_URL) are introduced. Guards are added to fail early on missing pull request URLs, failed gh api calls, unsupported event types, and empty or null resolved URLs.

Changes

PR URL Resolution Hardening

Layer / File(s) Summary
Event-driven PR URL resolution with guards
.github/workflows/pr-review-mention-reusable.yml
Replaces if/elif/else URL resolution with a case on EVENT_NAME. Introduces PR_HTML_URL and ISSUE_PR_API_URL intermediate env vars. Adds early failure when issue_comment lacks a pull_request URL, wraps gh api in guarded retrieval with explicit error messages and exit codes, handles unsupported event names, and validates that the final PR_URL is non-empty and not null before continuing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • petry-projects/.github#266: Modifies the same reusable workflow (pr-review-mention-reusable.yml) in the same "Resolve PR URL" step, updating how the PR URL is derived for issue_comment events.

Suggested labels

needs-human-review

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-500-20260620-2138

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 21:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new script, resolve-pr-url.sh, to correctly resolve the PR HTML URL across different GitHub event triggers, along with a comprehensive bats test suite and a mock gh stub. The feedback suggests adding error handling to the gh api call in the resolver script to handle failures gracefully under set -e, and refactoring the tab-separated line parsing in the gh stub to use Bash's built-in read instead of multiple awk subshells.

Comment thread .github/scripts/pr-review-mention/resolve-pr-url.sh Outdated
Comment thread test/workflows/pr-review-mention/stubs/gh Outdated
@don-petry
don-petry disabled auto-merge June 20, 2026 21:49
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
2. **Tier 1 Blockers**: ✅ **None**
   - No CI checks with `failure`, `timed_out`, `action_required`, or `startup_failure`
   - No reviews with state `CHANGES_REQUESTED`
   - gemini-code-assist[bot] left a `COMMENTED` review (suggestions, not blocking)
3. **In-Progress Checks**: ✅ **Not blocking**
   - "Analyze (actions)" is still running but not failed
   - Some dev-lead checks are pending but not failed
### Conclusion
The PR is in good shape. The SonarCloud bot reports zero issues and a passing quality gate. The gemini-code-assist suggestions in the `COMMENTED` review are code quality improvements (using Bash `read` instead of `awk`, adding optional error handling), but they don't indicate real bugs or compliance violations—the tests pass, the logic is correct, and the feature (issue #500 fix) works as designed.
**No changes needed at this time.**

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 21:50
@don-petry

Copy link
Copy Markdown
Contributor Author

@donpetry-bot please review — fixes the pr-review-mention dispatcher (#500). Event-aware resolve-pr-url.sh + tests.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

…heckout)

The first cut fixed #500 by extracting resolve-pr-url.sh and adding a
`Checkout dispatcher tooling` step to fetch it. In this privileged,
comment-triggered reusable that checkout tripped CodeQL
(actions/untrusted-checkout/high + the TOCTOU variant) — a self-inflicted
high-severity finding.

Resolve the PR URL inline in the `Resolve PR URL` step instead: same
event-aware logic (issue_comment / pull_request_review_comment /
pull_request[review_requested]) with the empty-URL guard so we never call
`gh api ""` (#500), but with no checkout, no `tooling_ref` input, and no
extra script — so there's no untrusted-checkout to flag.

Removes the now-unneeded resolve-pr-url.sh, its bats suite, and the
pr-review-mention-tests.yml gate (the ~12-line resolver lives inline in the
workflow now). The tooling_ref+checkout pattern in auto-rebase/feature-ideation
reusables is unaffected — they don't run in the privileged issue_comment
context that makes the checkout risky here.

Refs #500.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@don-petry

Copy link
Copy Markdown
Contributor Author

@donpetry-bot please review — reworked to resolve the PR URL inline (removed the privileged checkout that introduced the CodeQL untrusted-checkout finding). Same #500 fix, no checkout.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

@don-petry
don-petry disabled auto-merge June 21, 2026 03:12
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 21, 2026 03:16
@don-petry
don-petry disabled auto-merge June 21, 2026 03:16
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
Addressed 0 threads:
(no open review threads)
Test verification: skipped — no code changes made this session
Files changed: none
Notes:
- coderabbitai has APPROVED the PR
- Gemini's review body includes suggestions (error handling in resolve-pr-url.sh,
  refactor awk in gh stub) but those are COMMENTED state, not CHANGES_REQUESTED,
  and no open thread exists for them — out of scope per constraints
- Two CI checks still in_progress (Analyze/actions, dev-lead/dispatch) but neither
  has a failure conclusion — not Tier 1 blockers
```

@don-petry
don-petry enabled auto-merge (squash) June 21, 2026 03:17
@don-petry
don-petry disabled auto-merge June 21, 2026 03:18
@donpetry-bot

donpetry-bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor
Superseded by automated re-review at 5044863883b998de7adf9e164fa54e8965263ff6 — click to expand prior review.

Review — fix requested (cycle 1/3)

The automated review identified the following issues. Please address each one:

Findings to fix

Automated review — NEEDS HUMAN REVIEW

Risk: MEDIUM
Reviewed commit: 5044863883b998de7adf9e164fa54e8965263ff6
Review mode: triage-approved (single reviewer)

Summary

Reworks the 'Resolve PR URL' step of the privileged, comment-triggered reusable workflow to fix #500: event-aware resolution (pull_request/review_requested, pull_request_review_comment, issue_comment) with an empty-URL guard so we never call gh api "". Strictly improves security (event payload moved into env vars; the earlier privileged checkout that tripped a CodeQL untrusted-checkout HIGH was removed and the resolver inlined). Holding approval only because the CodeQL run that must confirm that HIGH is cleared is still in progress.

Linked issue analysis

Closes #500 (bug 1). The empty-URL guard + event-name case directly resolve the 'dispatcher fails on review_requested / empty gh api URL' failure: review_requested arrives as a pull_request event and now uses github.event.pull_request.html_url; issue_comment guards against a missing issue.pull_request.url before the API round-trip. Bug 2 (agent comment runaway) is explicitly out of scope for this workflow file — tracked separately in .github-private.

Findings

  • Fix is correct and complete for pr-review: dispatcher fails on review_requested (empty gh api URL) + agent comment runaway #500; all three event types handled with empty/null guards.
  • Security improvement: event values now flow through env vars (EVENT_NAME, PR_HTML_URL, ISSUE_PR_API_URL) instead of inline ${{ }} interpolation in shell — removes the script-injection surface in this privileged workflow. gh api "$ISSUE_PR_API_URL" is quoted and the URL is GitHub-generated.
  • Prior iteration's privileged checkout (CodeQL actions/untrusted-checkout HIGH) was removed; resolver logic is inline. resolve-pr-url.sh + its bats suite + the test gate were deleted accordingly.
  • gemini-code-assist COMMENTED suggestions (add error handling, refactor awk) targeted the now-deleted resolve-pr-url.sh — moot, no open CHANGES_REQUESTED thread.
  • Hold-to-approve: CodeQL 'Analyze (actions)' is still IN_PROGRESS. Because this commit's explicit purpose is to clear the earlier CodeQL untrusted-checkout HIGH, approval should wait for that check to land green rather than assert the finding is resolved while it is still running.

CI status

  • CodeQL 'Analyze (actions)': IN_PROGRESS (security-relevant — must complete green to confirm the untrusted-checkout HIGH is cleared)
  • coderabbitai review: APPROVED; CodeRabbit status: SUCCESS
  • SonarCloud: Quality Gate passed (0 new issues, 0 security hotspots)
  • dev-lead / dispatch: SUCCESS; pr-auto-review / check-and-dispatch: SUCCESS
  • dependabot-automerge, dev-lead / ci-relay: SKIPPED
  • reviewDecision REVIEW_REQUIRED (org-leads team requested); mergeStateStatus BLOCKED — human review already required.

Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 21, 2026 03:20
@don-petry

Copy link
Copy Markdown
Contributor Author

@donpetry-bot review please — CodeQL now green after the inline rework; this is the fix for the pr-review dispatcher (#500).

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 5044863883b998de7adf9e164fa54e8965263ff6
Review mode: triage-approved (single reviewer)

Summary

Confirmation re-review of the inline-resolver rework of the privileged, comment-triggered pr-review-mention-reusable.yml (#500). The prior single-reviewer pass on this exact SHA held approval for one reason only: the CodeQL Analyze (actions) run — which must confirm the earlier untrusted-checkout HIGH was cleared — was still IN_PROGRESS. That check is now COMPLETED / SUCCESS, so the sole hold is resolved. The change itself is a net security improvement: event payload values are read from env vars (EVENT_NAME, PR_HTML_URL, ISSUE_PR_API_URL) instead of inline ${{ }} shell interpolation, with an empty/null URL guard so gh api "" is never called.

Linked issue analysis

Closes #500. The case "$EVENT_NAME" block handles all three triggers — pull_request/pull_request_review_comment use the PR html_url directly; issue_comment guards against a missing issue.pull_request.url before the API round-trip — and a final empty/null guard prevents an empty gh api call. This directly fixes the "dispatcher fails on review_requested / empty gh api URL" failure. Bug 2 (agent comment runaway) is out of scope for this workflow file and tracked separately.

Findings

  • Fix is correct and complete for #500; all event types handled with empty/null guards.
  • Security improvement: privileged-workflow event values now flow through env vars, removing the inline-interpolation script-injection surface; gh api "$ISSUE_PR_API_URL" is quoted and GitHub-generated.
  • The prior iteration's privileged checkout (CodeQL untrusted-checkout HIGH) was removed and the resolver inlined; the now-moot resolve-pr-url.sh, its bats suite, and the test gate were deleted accordingly.
  • gemini-code-assist's two suggestions (add gh api error handling; refactor awk in the test stub) are on the deleted files; both review threads are RESOLVED + OUTDATED, and the error-handling suggestion is in fact now implemented inline. No open or CHANGES_REQUESTED threads remain.
  • coderabbitai APPROVED at this SHA.

CI status

  • CodeQL Analyze (actions): SUCCESS (was the sole prior hold — now green, confirms untrusted-checkout HIGH cleared); CodeQL: SUCCESS
  • coderabbitai: APPROVED; CodeRabbit status: SUCCESS
  • SonarCloud: Quality Gate passed (0 new issues, 0 security hotspots)
  • Lint, ShellCheck, Agent Security Scan, AgentShield, Secret scan (gitleaks): SUCCESS
  • dev-lead / dispatch, pr-auto-review / check-and-dispatch: SUCCESS
  • dependency audits, dev-lead / ci-relay, dependabot-automerge: SKIPPED
  • Note: reviewDecision REVIEW_REQUIRED (org-leads team) — org-level human approval still gates merge; this agent verdict does not bypass it.
  • GitHub Secret Protection MCP scan unavailable in this run; relied on the passing gitleaks CI check.

Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry merged commit 455a460 into main Jun 21, 2026
19 of 20 checks passed
@don-petry
don-petry deleted the dev-lead/issue-500-20260620-2138 branch June 21, 2026 11:23
don-petry added a commit that referenced this pull request Jun 24, 2026
…DR (#869) (#520)

* docs(standards): formalize the agent canary-ring/soak/promotion model + ADR (#869)

The rings model in ci-standards.md was documented aspirationally and as a
cut-release.sh-only (manual) process. dev-lead v1.4.0 has now shipped end-to-end
through the automated, health-gated pipeline, so promote the standard to match:

- Ring table → the canonical host-relative model: next=host, ring0=other org-infra
  repo, ring1=named low-traffic consumers, stable=rest. Points at canary-rings.json
  as the membership SoT.
- "Rollout status" → reflects the built automation: canary-rollout.sh + the 4h
  evaluate / dispatch-gated promote, the concrete soak gate (healthy >= ceil(baseline/7)
  AND failure-rate <= baseline, no floor), rollback mechanics, and the codified
  release-channel-tags ruleset (apply-rulesets.sh).
- New ADR docs/initiatives/agent-canary-rings-adr.md — records the decision +
  rationale (immutable releases + moving channels, host-relative rings, health-gated
  promotion, circular-dependency fix).

DRAFT until the host-repo implementation PRs land (.github-private #878 canary-rollout,
#889 ruleset codify, #880 SHA-pin guardrail) — this standard references them.

Closes #869. Refs #495, #499, #500, #501, #502, #868.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(bot): address bot feedback [skip ci-relay]

* fix(reviews): address review comments [skip ci-relay]

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
Co-authored-by: Don Petry Bot <donpetry+bot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-review: dispatcher fails on review_requested (empty gh api URL) + agent comment runaway

2 participants