Ignore Dependabot security updates in the failure watcher - #215
Conversation
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Dependabot failure watcher now documents Dependabot run title categories and uses server-side date filtering plus explicit ChangesDependabot watcher
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Adjusts the “Dependabot Failure Watcher” workflow to avoid reporting failures from Dependabot security update runs (which commonly fail for reasons this repo can’t fix), while still flagging failures from Dependabot version update activity. This helps keep the scheduled watcher signal meaningful instead of perpetually red.
Changes:
- Add detailed documentation explaining the three “Dependabot Updates” run types and why security-update runs are excluded.
- Filter out security-update runs by
displayTitlepatterns (including the load-bearing" in /. for "substring) and exclude known noisy directories (/e2e/jsand/e2e/ts). - Bound
gh run listserver-side using--createdand increase--limitto reduce the chance of truncating in-window results.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/dependabot-failure-watcher.yml:
- Around line 88-98: Update the Dependabot run collection in the “Dependabot
Updates” gh run list block so it cannot report all-clear from a truncated
result: either paginate through all runs until the --created date boundary is
exhausted, or fail closed when the returned count reaches the configured --limit
of 500. Preserve the existing filtering and failed-run evaluation, ensuring any
potential truncation prevents an all-clear outcome.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1e7fe281-0a09-43ff-8607-07d8581dd260
📒 Files selected for processing (1)
.github/workflows/dependabot-failure-watcher.yml
| # --created filters server-side, so --limit applies to runs already | ||
| # narrowed to the window rather than to all of history. Runs come back | ||
| # newest-first, so reaching the limit would drop the oldest in-window | ||
| # runs and this step would report all-clear without them -- hence a | ||
| # limit far above any plausible week's worth of runs. | ||
| runs=$(gh run list \ | ||
| --repo "$REPO" \ | ||
| --workflow "Dependabot Updates" \ | ||
| --limit 100 \ | ||
| --json conclusion,createdAt,displayTitle,url \ | ||
| --jq "[.[] | select((.conclusion == \"failure\" or .conclusion == \"startup_failure\" or .conclusion == \"timed_out\") and .createdAt >= \"$since\")]") | ||
| --created ">=$since" \ | ||
| --limit 500 \ | ||
| --json conclusion,createdAt,displayTitle,url) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== locate workflow ==="
fd -a 'dependabot-failure-watcher.yml|dependabot.* watcher|failure-watcher' .github || true
echo "=== workflow relevant lines ==="
if [ -f .github/workflows/dependabot-failure-watcher.yml ]; then
nl -ba .github/workflows/dependabot-failure-watcher.yml | sed -n '1,150p'
else
echo "workflow not found"
fi
echo "=== gh run list docs/files in repo mentioning limit or truncation ==="
rg -n "gh run list|--created|limit|truncated|all clear|all-clear" .github/workflows/dependabot-failure-watcher.yml .github/workflows README.md . 2>/dev/null | head -200Repository: maxmind/MaxMind-DB-Reader-ruby
Length of output: 332
🌐 Web query:
GitHub CLI gh run list --limit --created documentation
💡 Result:
The GitHub CLI command gh run list allows you to filter workflow runs by creation date and limit the number of results returned [1][2]. Usage syntax: gh run list --limit --created Flags: -L, --limit : Specifies the maximum number of workflow runs to fetch [1]. The default value is 20 [1][2]. --created : Filters runs by the date they were created [1][3]. This flag supports GitHub's standard search syntax for date ranges [4][5]. Examples of date range syntax for the --created flag include: - Exact date: --created "2024-01-01" - Range: --created "2024-01-01..2024-02-01" - Relative/Greater than: --created ">=2024-01-01" [5] For more information, you can run gh help run list in your terminal or visit the official GitHub CLI manual [1][2].
Citations:
- 1: https://cli.github.com/manual/gh_run_list
- 2: https://manpages.debian.org/testing/gh/gh-run-list.1.en.html
- 3: https://fossies.org/linux/gh-cli/pkg/cmd/run/list/list.go
- 4: Allow filtering workflow runs by date range in gh run list cli/cli#9042
- 5: Improve help text for --created flag in gh run list cli/cli#13043
🏁 Script executed:
#!/bin/bash
set -u
echo "=== workflow relevant lines ==="
awk '{printf "%6d %s\n", NR, $0}' .github/workflows/dependabot-failure-watcher.yml | sed -n '1,150p'
echo "=== changed diff stat/name-only ==="
git diff --stat -- .github/workflows/dependabot-failure-watcher.yml || true
git diff -- .github/workflows/dependabot-failure-watcher.yml | sed -n '1,220p' || trueRepository: maxmind/MaxMind-DB-Reader-ruby
Length of output: 7024
Do not report “all clear” from a potentially truncated result.
When 500 or more Dependabot runs exist in the eight-day window, gh run list caps the returned results, but the workflow still treats that list as complete. That can let an older failed run be omitted from the all-clear. Paginate until the date bound is exhausted, or fail closed when the return length reaches the configured limit.
Suggested minimum safeguard
+ run_limit=500
runs=$(gh run list \
...
- --limit 500 \
+ --limit "$run_limit" \
--json conclusion,createdAt,displayTitle,url)
+ if [ "$(jq 'length' <<<"$runs")" -eq "$run_limit" ]; then
+ echo "::error::Dependabot run query reached its limit; refusing to report all-clear."
+ exit 1
+ fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # --created filters server-side, so --limit applies to runs already | |
| # narrowed to the window rather than to all of history. Runs come back | |
| # newest-first, so reaching the limit would drop the oldest in-window | |
| # runs and this step would report all-clear without them -- hence a | |
| # limit far above any plausible week's worth of runs. | |
| runs=$(gh run list \ | |
| --repo "$REPO" \ | |
| --workflow "Dependabot Updates" \ | |
| --limit 100 \ | |
| --json conclusion,createdAt,displayTitle,url \ | |
| --jq "[.[] | select((.conclusion == \"failure\" or .conclusion == \"startup_failure\" or .conclusion == \"timed_out\") and .createdAt >= \"$since\")]") | |
| --created ">=$since" \ | |
| --limit 500 \ | |
| --json conclusion,createdAt,displayTitle,url) | |
| # --created filters server-side, so --limit applies to runs already | |
| # narrowed to the window rather than to all of history. Runs come back | |
| # newest-first, so reaching the limit would drop the oldest in-window | |
| # runs and this step would report all-clear without them -- hence a | |
| # limit far above any plausible week's worth of runs. | |
| run_limit=500 | |
| runs=$(gh run list \ | |
| --repo "$REPO" \ | |
| --workflow "Dependabot Updates" \ | |
| --created ">=$since" \ | |
| --limit "$run_limit" \ | |
| --json conclusion,createdAt,displayTitle,url) | |
| if [ "$(jq 'length' <<<"$runs")" -eq "$run_limit" ]; then | |
| echo "::error::Dependabot run query reached its limit; refusing to report all-clear." | |
| exit 1 | |
| fi |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/dependabot-failure-watcher.yml around lines 88 - 98,
Update the Dependabot run collection in the “Dependabot Updates” gh run list
block so it cannot report all-clear from a truncated result: either paginate
through all runs until the --created date boundary is exhausted, or fail closed
when the returned count reaches the configured --limit of 500. Preserve the
existing filtering and failed-run evaluation, ensuring any potential truncation
prevents an all-clear outcome.
Source: MCP tools
GitHub runs both Dependabot version updates and Dependabot security
updates under one workflow name, "Dependabot Updates", and the watcher
counted both. Security updates routinely fail for reasons no pull request
can fix -- the advisory is against a dependency this project does not
declare directly, or no patched version is reachable. Left alone the
watcher stays red every week on those and trains everyone to ignore it.
Filter those runs out by title. Version updates are unaffected.
The title check is subtler than it looks, so document it properly. A
security job is marked by "/." AND a " for " suffix together; version
updates are either "/." with no " for " (the scheduled scan) or "/" with
one (the pull request). Both halves of " in /. for " are therefore
load-bearing -- matching on " in /." alone would discard every scan run,
which is most of the version-update runs and the shape the failures this
watcher was written for actually took.
That "/." spelling only separates the two at the repo root. In a
subdirectory a security update and a version update's pull request render
identically, so drop " in /e2e/{js,ts} for " by name as well. The Node
repos this workflow is shared with carry committed lockfiles under e2e/js
and e2e/ts, whose transitive dev dependencies attract advisories no pull
request can fix, and nothing in either is shipped code. That is 16
unactionable failures in each of GeoIP2-node and minfraud-api-node over
retained history; repos without those directories are unaffected.
Unlike the root filter, this one is not free. Both Node repos configure
npm with directories: ["/", "**/*"], and that glob does match e2e/js and
e2e/ts, so those directories do get version updates -- there is an open
version-update pull request under e2e/ts in both repos as this is
written. Dropping the pattern discards their pull-request refresh
failures along with the security jobs, and the ecosystem label is no help
because Dependabot writes "npm_and_yarn" for both. Taken anyway: the
scheduled scan is what this watcher primarily exists to catch and is
still reported for those directories, so what is given up is the narrower
"one open pull request has gone stale" signal for two directories of test
scaffolding. After filtering, 4 genuine failures remain reported in
GeoIP2-node and 3 in minfraud-api-node.
Reading the directories out of dependabot.yml would look more general and
was the earlier plan here, but it fails green. Entries may use globs, and
minfraud-api-dotnet's directories: ["**/*"] yields titles like "nuget in
/**/*" for the scan and "nuget in /MaxMind.MinFraud for
System.Net.Http.Json" for the pull request, neither of which any literal
comparison against the configured value matches -- so its two real nuget
failures would have been dropped without a word. A stale denylist
re-introduces noise, which is loud; a stale allowlist hides failures.
Name the three kinds of run in the comment while here, because the
scheduled scan and the per-pull-request refresh are easy to conflate: the
refresh runs are one per open pull request and are triggered by pushes to
the base branch or by rebases, not by the schedule, so they arrive in
bursts after merges. The scan is the kind this watcher primarily exists
to catch, which is what makes hiding a hypothetical refresh failure under
e2e an acceptable cost rather than a hole.
Bound the query server-side with --created instead of fetching all of
history and filtering by date locally, so --limit now caps an
already-narrowed window rather than standing in for one, and the run list
drops from several API pages to one. --limit rises 100 -> 500 as a
backstop: it still applies before the title filter, and reaching it would
silently drop the oldest in-window runs.
This workflow is shared verbatim across MaxMind repos. The change was
developed in maxmind/device-android and is applied here unmodified; see
that repo's commit for the measurements it was derived from.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4d42c49 to
5d33bb6
Compare
GitHub runs Dependabot version updates and Dependabot security updates under one
workflow name,
Dependabot Updates, and the watcher counted both. Securityupdates routinely fail for reasons no pull request can fix -- the advisory is
against a dependency the project does not declare directly, or no patched
version is reachable -- so the watcher stays red every week on those and trains
everyone to ignore it.
This filters security-update runs out by title, documents why both halves of
" in /. for "are load-bearing, and bounds thegh run listquery server-sidewith
--createdinstead of fetching all of history and filtering locally.See the commit message for the full reasoning, including why reading the
directory list out of
dependabot.ymlwas tried and rejected.This workflow is shared verbatim across MaxMind repos. The change was developed
in maxmind/device-android (maxmind/device-android#71)
and is applied here unmodified; the resulting file is byte-identical in every
repo.
Summary by CodeRabbit
Bug Fixes
Documentation