Skip to content

feat: add CI monitor for agent PRs - #40

Open
shenxianpeng wants to merge 2 commits into
mainfrom
feature/add-repokeeper-commands-search-ci-monitor
Open

feat: add CI monitor for agent PRs#40
shenxianpeng wants to merge 2 commits into
mainfrom
feature/add-repokeeper-commands-search-ci-monitor

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented May 21, 2026

Copy link
Copy Markdown
Owner

Summary

After the Implementation Agent creates a PR, there is no mechanism to detect or fix CI failures on that PR. This PR adds CI Monitor — a new module that watches agent PRs for CI failures, diagnoses them from real job log data, and auto-pushes fixes to the same branch.

New Module

src/repokeeper/ci_monitor.py

  • get_pr_check_status() — queries GitHub Checks API for a PR's check runs
  • find_agent_prs() — discovers open PRs on repokeeper/ branches
  • diagnose_and_fix_ci() — fetches job/step logs, calls LLM for diagnosis, applies fix, pushes
  • run_ci_monitor() — top-level pipeline: find PRs → check status → auto-fix failures

Integration

  • cli.py — new repokeeper ci-monitor --repo owner/repo subcommand
  • action.yml — new module: ci-monitor for GitHub Actions workflows
  • Profile — gated by existing patrol.ci_auto_fix (default: true)

Example workflow

name: RepoKeeper CI Monitor
on:
  schedule:
    - cron: '*/10 * * * *'
jobs:
  ci-monitor:
    runs-on: ubuntu-latest
    steps:
      - uses: shenxianpeng/repokeeper@v1
        with:
          module: ci-monitor
          repo: ${{ github.repository }}
          llm_api_key: ${{ secrets.DEEPSEEK_API_KEY }}
          github_token: ${{ secrets.REPOKEEPER_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

Docs

  • README.md — added CI monitor to feature list and comparison table
  • docs/module-3-agent.md — added Step 10: CI Monitoring section with workflow example

Verification

495 tests passed · 80% coverage · 0 mypy errors · 0 ruff errors

Add three new modules to make RepoKeeper the best AI-powered OSS
maintainer agent on GitHub:

- commands.py: dedicated /repokeeper comment command parser
  (go, review, describe, label, fix, status, help)
- search.py: codebase grep with git grep + Python fallback,
  discover_related_files for import/dependency traversal
- ci_monitor.py: watches agent PRs for CI failures, diagnoses
  from real job logs, pushes auto-fixes to the same branch

Also:
- agent.py: wires in /repokeeper help and /repokeeper status
- cli.py: ci-monitor, search, help subcommands
- action.yml: supports module=ci-monitor and module=help
- Fix _parse_git_grep_output for heading-format git grep output

543 tests pass, 80% coverage, 0 mypy errors, 0 ruff errors
@github-actions github-actions Bot added enhancement New feature or request testing Issues related to testing and code coverage labels May 21, 2026
@codecov-commenter

codecov-commenter commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.10%. Comparing base (31dbad6) to head (65c8fce).

Files with missing lines Patch % Lines
src/repokeeper/cli.py 89.47% 1 Missing and 1 partial ⚠️

❌ Your project status has failed because the head coverage (78.10%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
+ Coverage   78.04%   78.10%   +0.05%     
==========================================
  Files          16       16              
  Lines        4173     4192      +19     
  Branches      766      768       +2     
==========================================
+ Hits         3257     3274      +17     
- Misses        715      716       +1     
- Partials      201      202       +1     
Flag Coverage Δ
unit 78.10% <89.47%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/repokeeper/cli.py 77.51% <89.47%> (+0.51%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Remove non-essential modules (commands.py, search.py) per review feedback.
Keep ci_monitor.py — the only feature that fills a genuine gap (no existing
mechanism to auto-fix CI on agent PRs after creation).

Also:
- Update README.md and docs/module-3-agent.md with CI monitor docs
- Revert agent.py command parser wiring
- Revert cli.py search/help subcommands (keep ci-monitor)
- Revert action.yml module=help (keep ci-monitor)
- Rewrite ci_monitor tests with mocks for full control flow coverage
- Fix lint in test_ci_monitor.py

495 tests pass, 80% coverage, 0 mypy errors, 0 ruff errors
@shenxianpeng shenxianpeng changed the title feat: add /repokeeper command parser, codebase search, and CI monitor feat: add CI monitor for agent PRs May 21, 2026
@shenxianpeng shenxianpeng removed the testing Issues related to testing and code coverage label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants