| name | stale-mr-finder |
| description | Identifies stale, orphaned, conflicting, duplicate, or otherwise problematic open merge requests for the Drupal AI project. |
Stale MR Finder
You scan open merge requests on git.drupalcode.org/project/ai and identify MRs that are stale, orphaned, or duplicated.
Scripts
Two scripts are provided:
fetch-open-mrs.sh
Fetches all open MRs from the GitLab API and caches them locally under stale-mrs/mr-cache.json. Cache is valid for 4 hours. Pass --force to bypass cache.
.claude/skills/stale-mr-finder/fetch-open-mrs.sh
analyze-mrs.sh
Cross-references cached MRs against issue state JSON files and outputs findings as pipe-delimited lines.
.claude/skills/stale-mr-finder/analyze-mrs.sh 3346420
Output format: category|iid|issue_nid|title|web_url|updated_at|details
The script checks issue status from two sources:
- Local state JSON files (fast, no network)
- Drupal.org API for any issue not in local state (cached for 24 hours under
stale-mrs/issue-status-cache/)
Categories:
closed_issue - MR is open but the linked issue is closed/fixed/duplicate/won't fix/outdated
postponed_issue - MR is open but the linked issue is postponed
duplicate - Multiple open MRs exist for the same issue (flags the older ones)
has_conflicts - MR has merge conflicts (open issue, but MR can't merge)
no_issue - No issue number found in MR branch name, title, or description
unknown_issue - Issue number not found on Drupal.org (deleted or from another project)
Workflow
- Run
fetch-open-mrs.sh to populate the cache (or use existing cache if fresh)
- Run
analyze-mrs.sh 3346420 to get the raw findings
- Review the output and produce a report
Reporting
Group findings by category and present them clearly:
MRs for closed issues
These should be closed on GitLab. The issue is resolved but the MR was left open.
Duplicate MRs
Multiple MRs for the same issue. Usually the older ones should be closed. Check which one is most recent/complete.
MRs with conflicts
These need attention - either rebase or close if abandoned.
Orphaned MRs (no issue)
MRs with no traceable issue number. These may be experimental branches or improperly named.
Output format
Report as text output directly - do not write files unless asked. Give a clear summary with counts and then the detailed list per category.
Important notes
- The GitLab API is public (no auth needed for drupal.org)
- Cache is stored under
stale-mrs/ at the project root
- Never write to
repos/ or drupal-issue-hygiene-helper/
- The analyze script uses issue state from
drupal-issue-hygiene-helper/state/{project_id}/latest_state/
- MRs targeting branches other than the main development branches are still valid if their issue is open