Inspiration

What it does

How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for MR Triage Agent

Inspiration

Code review bottlenecks slow teams down. Maintainers waste time manually assessing MR quality, identifying duplicates, and deciding review order. We built MR Triage Agent to automate this entire workflow on GitLab.

What it does

MR Triage Agent automatically scores, ranks, and triages merge requests when triggered by an @mention. It features:

  • 3-Tier Cascade Scoring (Green Agent) — Draft/failed/conflicting MRs get instant skip mode (15/100, zero LLM analysis). Oversized MRs get heuristic scoring. Only ready MRs get full 5-category deep analysis. This dramatically reduces unnecessary token consumption.
  • Duplicate Detection — Compares MR titles across all open MRs using word overlap analysis. >90% overlap adds a duplicate::suspect label, >70% triggers a warning in the report.
  • Live Dashboard — Creates and maintains a GitLab issue tracking all triaged MRs in a table with scores, priorities, and dates.
  • 5-Category Report Cards — Code Quality (25%), CI Health (20%), Description (15%), Scope & Risk (25%), Readiness (15%) with actionable suggestions.
  • Green Report Footer — Every report shows the cascade mode used, API calls made, and LLM analysis level for full transparency.

How we built it

Single AgentComponent on GitLab Duo Agent Platform using YAML v1 flow specification. The agent uses a 4-phase prompt architecture:

  1. Data Collectiongitlab_api_get for MR metadata and pipeline status
  2. Cascade Scoring — 3-tier system (skip/quick/full) to minimize compute
  3. Duplicate Detection — Word overlap comparison across open MRs
  4. Reporting — Comment, labels, and dashboard issue via create_merge_request_note, update_merge_request, create_issue, update_issue

Zero external services — runs entirely on GitLab infrastructure.

Challenges we ran into

  • Platform's get_merge_request tool doesn't auto-resolve MR context in flow triggers — solved by using gitlab_api_get with explicit API paths
  • Designing the cascade scoring to be both resource-efficient and accurate
  • Balancing duplicate detection thresholds to avoid false positives

Accomplishments that we're proud of

  • Skip mode processes draft MRs with zero LLM token usage — just 2 API calls
  • The agent correctly detects duplicate MRs across the project
  • Live dashboard issue auto-maintains itself across triage runs
  • Single agent, single flow, no external dependencies

What we learned

  • GitLab Duo Agent Platform is powerful for building autonomous workflows
  • Cascade/tiered processing is key for resource-efficient AI agents
  • Simple heuristics (word overlap) can be surprisingly effective for duplicate detection

What's next for MR Triage Agent

  • Semantic duplicate detection using embeddings
  • Auto-assignment of reviewers based on file ownership
  • Scheduled triage runs for all open MRs
  • Multi-project dashboard aggregation

Built With

  • gitlab-duo-agent-platform
Share this project:

Updates