Enable Duo Code Review to read repo files in custom instructions

Problem

Currently, Duo Code Review can read custom instructions from .gitlab/duo/mr-review-instructions.yaml but cannot fetch and read content from other repo files. This limits the ability to provide comprehensive, documentation-backed reviews for specialized areas like database migrations.

For database migration reviews, we want to reference detailed documentation (e.g., https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/database/avoiding_downtime_in_migrations.md) without duplicating all content in the custom instructions file.

Proposal

Update the custom instructions tool to support reading content from links specified in the instructions. This would allow custom instructions like:

- name: Database Migrations
  fileFilters:
    - "db/migrate/**/*.rb"
    - "db/post_migrate/**/*.rb"
    - "ee/db/geo/migrate/**/*.rb"
    - "lib/gitlab/background_migration/**/*.rb"
  instructions: |
    1. Ensure database-related instructions are followed: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/database/avoiding_downtime_in_migrations.md

Benefits

  1. No customer impact: Documentation links would be specific to gitlab-org/gitlab custom instructions
  2. Scoped context: Fetched documentation stays within the <custom_instructions> section without interfering with the main prompt
  3. Maintainability: Reference authoritative documentation instead of duplicating content
  4. Automation: Can catch common database migration mistakes automatically (e.g., disabling transactions when adding columns, missing foreign key constraints)

Considerations

  • Documentation pages are verbose and meant for humans, not structured XML/JSON
  • Need to monitor for potential information overload
  • Should be tested behind a feature flag to avoid impacting Duo Code Review performance or comment quality

Related

Edited by Kinshuk Singh