feat: add diagnose_ci tool for CI failure diagnosis#192
Merged
ichoosetoaccept merged 1 commit intomainfrom Feb 19, 2026
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
Greptile SummaryAdds a new Key changes:
Issue found:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[diagnose_ci tool call] --> B{run_id provided?}
B -->|Yes| C[Use specified run_id]
B -->|No| D[Find latest failed run]
D --> E{pr_number provided?}
E -->|Yes| F[Get branch from PR]
E -->|No| G[Use current branch]
F --> H[gh run list --branch]
G --> H
H --> I[Filter for failed runs]
C --> J[Get run details]
I --> J
J --> K[Extract failed jobs]
K --> L{Failed jobs found?}
L -->|No| M[Return error: no jobs failed]
L -->|Yes| N[Get failed logs]
N --> O[Clean log lines]
O --> P[Extract error lines with context]
P --> Q{Multiple failed jobs?}
Q -->|Yes| R[Match errors to job names]
Q -->|No| S[Assign all errors to job]
R --> T[Build CIJobFailure objects]
S --> T
T --> U[Return CIDiagnosisResult]
Last reviewed commit: 47bd4c3 |
Member
Author
Merge activity
|
1c6a854 to
47bd4c3
Compare
|
Found 1 test failure on Blacksmith runners: Failure
|
3 tasks
ichoosetoaccept
added a commit
that referenced
this pull request
Feb 24, 2026
## Description Adds 70 lines of new test coverage for `tools/ci.py` to bring the CI module above the fail-under threshold. Covers error paths, edge cases in log parsing, and the `run_id` vs `pr_number` detection branches. ## Changes - **`tests/test_ci.py`** — new test cases for CI diagnosis edge cases (empty logs, missing steps, malformed output, run ID lookup) ## Checklist - [x] Tests added/updated - [x] `poe check` passes - [x] Commit messages follow [conventional commits](../CONTRIBUTING.md#commit-message-convention) ## Related Issues Fixes CI coverage regression from #192 (`diagnose_ci` tool addition).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Add a new
diagnose_ciMCP tool that lets agents quickly diagnose GitHub Actions CI failures in a single call, replacing the typical 3-5 sequentialghcommands.Problem
Agents currently need to run multiple
ghcommands to diagnose CI failures:gh run list→ find failed runsgh run view <id> --json jobs→ find failed jobsgh run view <id> --log-failed→ get error logsSolution
The
diagnose_citool collapses this into one call that returns structured results:run_id)New files
src/codereviewbuddy/tools/ci.py— business logic (diagnose_ci, log parsing, error extraction)tests/test_ci.py— 23 tests covering helpers and integration scenariosChanges to existing files
src/codereviewbuddy/models.py— addCIJobFailureandCIDiagnosisResultmodelssrc/codereviewbuddy/server.py— registerdiagnose_citool with prerequisite validationtests/test_mcp_integration.py— adddiagnose_cito expected tools set, bump count to 13Bug fix included
Fixed prerequisite validation: when
run_idis provided withoutrepoand no workspace is detected, the tool now correctly requiresrepoto be provided (previously skipped the check entirely).Checklist
poe checkpasses