Skip to content

fix(triggers): fix respond-to-ci for CodeQL and review-requested dedup#1034

Merged
zbigniewsobiecki merged 2 commits intodevfrom
fix/trigger-check-suite-and-review-dedup
Mar 24, 2026
Merged

fix(triggers): fix respond-to-ci for CodeQL and review-requested dedup#1034
zbigniewsobiecki merged 2 commits intodevfrom
fix/trigger-check-suite-and-review-dedup

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • respond-to-ci: GitHub's CodeQL check suite sends check_suite.completed with pull_requests: [] and head_branch: "feature/..." (not refs/pull/N/head). The old matches() guard rejected these, so CodeQL failures never triggered respond-to-ci. Fix: relaxed matches() to accept all check_suite failures; handle() now falls back to githubClient.getOpenPRByBranch() when the PR number can't be derived from the payload or ref.
  • review-requested: When CI passes, check-suite-success claims the PR+SHA dedup key. A subsequent manual review request within the 30-min TTL was silently blocked. Fix: review-requested now releases the dedup key before claiming it, so a human-initiated review always fires.

Root cause evidence

  • Webhook logs showed all check_suite events at ~13:42 UTC (when CodeQL failed on PR docs: add Adding Engines guide and update backends README #1030) as "No trigger matched"
  • Router log at 15:44 UTC: "Review already dispatched for this PR+SHA, skipping" for mongrel-intelligence/cascade:1030:51e254... — set by check-suite-success at 15:36

Test plan

  • CI passes
  • Force a CodeQL failure on an implementer PR → respond-to-ci fires
  • Request review after CI has already queued a review → trigger fires instead of being deduped

🤖 Generated with Claude Code

Two trigger fixes:

1. check-suite-failure: relax matches() to accept all check_suite failures
   and add getOpenPRByBranch() fallback when pull_requests[] is empty and
   head_branch is not a refs/pull/N/head ref. GitHub's CodeQL check suite
   sends pull_requests: [] with the regular branch name, causing the handler
   to silently skip all CodeQL failures.

2. review-requested: release the dispatch dedup before claiming so a human
   explicitly requesting review always succeeds, even if check-suite-success
   already claimed the PR+SHA dedup key within the 30-min TTL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 5267e97 into dev Mar 24, 2026
8 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/trigger-check-suite-and-review-dedup branch March 24, 2026 16:15
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.

1 participant