Implement automated CI failure investigator#3861
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
This Pull Request successfully implements an automated CI failure investigator powered by Gemini. The diagnostics protocol is well-defined and systematic, offering a great balance between efficiency and depth.
🔍 General Feedback
- Regression Alert: There is a regression in
gemini-dispatch.ymlwhereadditional_contextparsing was removed for the/reviewcommand. I've suggested a fix to restore this and extend it to/investigate. - Workflow Robustness: The fallback logic for identifying the failed run ID could be made more specific to the current PR branch to avoid false positives in high-traffic periods.
- Protocol Excellence: The systematic approach in
gemini-investigate.toml(cheap actions first, grouping failures) is a highlight and should serve as a model for other automated commands.
| const additionalContext = request.replace(/^@gemini-cli \/review/, '').trim(); | ||
| core.setOutput('additional_context', additionalContext); | ||
| core.setOutput('additional_context', ''); | ||
| } else if (request.startsWith("@gemini-cli /investigate")) { |
There was a problem hiding this comment.
| } else if (request.startsWith("@gemini-cli /investigate")) { | |
| } else if (request.startsWith("@gemini-cli /review")) { | |
| core.setOutput('command', 'review'); | |
| const additionalContext = request.replace(/^@gemini-cli \/review/, '').trim(); | |
| core.setOutput('additional_context', additionalContext); | |
| } else if (request.startsWith("@gemini-cli /investigate")) { | |
| core.setOutput('command', 'investigate'); | |
| const additionalContext = request.replace(/^@gemini-cli \/investigate/, '').trim(); | |
| core.setOutput('additional_context', additionalContext); |
There was a problem hiding this comment.
Its intended, to protect against context injection.
|
|
||
| # Determine target run ID | ||
| if [ -z "$RUN_ID" ]; then | ||
| # Fallback to finding the latest failed run for this PR if triggered manually |
There was a problem hiding this comment.
Consider filtering by the head branch or PR to ensure the investigator analyzes the relevant failure. If this is triggered via issue_comment on a PR, you can retrieve the head branch name and pass it to gh run list --branch <branch>.
| workflow_call: | ||
| inputs: | ||
| additional_context: | ||
| type: 'string' |
There was a problem hiding this comment.
| type: 'string' | |
| workflow_call: | |
| inputs: | |
| additional_context: | |
| type: 'string' | |
| required: false | |
| failed_run_id: | |
| type: 'string' | |
| required: false |
| "args": [ | ||
| "run", | ||
| "-i", | ||
| "--rm", |
There was a problem hiding this comment.
The current list is good, but for "searching git history", you might eventually want tools that can run git log or git blame if the shell tool is too restricted (though here you've allowed cat, grep, etc., which is a good start).
RissyRan
left a comment
There was a problem hiding this comment.
@gemini-cli /investigate
7f80543 to
a58ee37
Compare
This PR implements a Gemini-powered automated investigator to diagnose CI test failures in the repository. It enables the @gemini-cli /investigate command and runs automatically on pipeline failures to provide actionable diagnostic feedback.
Key Features:
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.