Exclude invalid custom instructions from code review context
What does this MR do and why?
Fix the Duo Code Review context gathering step by ignoring invalid custom instructions.
If an invalid custom instruction is returned to AIGW, the build_review_merge_request_context step will fail and no context is passed to the LLM, turning the whole code review useless and generating a summary that does not reflect what happened.
This MR proactively excludes malformed custom instructions so that doesn't happen.
References
Fixes #601920 (closed).
How to set up and validate locally
In the master branch:
- Create a project with invalid custom instructions
instructions: - name: "General insntructions" rules: "Do something" - Create a MR and request a review from Duo
- Duo will try to build the review context and will fail because rules are invalid
- Checkout this branch and try again. Duo should ignore the invalid instructions and build context as usual
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Wanderson Policarpo
