Skip to content

Agentic GitHub issue solver that automatically discovers bugs, generates patches, and creates pull requests.

License

Notifications You must be signed in to change notification settings

CodeRustyPro/openfix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenFix πŸ€–

AI-powered GitHub issue solver that automatically discovers bugs, generates patches, and creates pull requests.

License: MIT Python 3.10+


✨ Features

  • πŸ” Automatic Issue Discovery - Scans repositories and triages issues by likelihood of automated fix
  • πŸ› οΈ AI Patch Generation - Uses Gemini AI to generate code patches with validation
  • πŸ”„ Iterative Repair - Self-improving patches through validation feedback loops
  • πŸ“Š Confidence Scoring - Risk assessment (0-100) for each generated patch
  • 🎯 Draft PR Creation - Automatically creates PRs with AI disclosure and review checklist
  • ⚑ GitHub Actions - Full CI/CD integration for automated workflows
  • πŸ–₯️ Interactive CLI - Beautiful terminal UI for patch review and approval

πŸš€ Quick Start

Installation

git clone https://github.com/CodeRustyPro/openfix.git
cd openfix

pip install -r requirements.txt

export GEMINI_API_KEY="your-gemini-api-key"
export GITHUB_TOKEN="your-github-token"

Basic Usage

# 1. Discover issues in a repository
python agents/discovery/discover_issues.py https://github.com/owner/repo

# 2. Generate a patch for a specific issue (interactive)
python scripts/cli.py solve https://github.com/owner/repo --issue 123

# 3. Full automation (discover + patch + PR)
python scripts/automate_full_pipeline.py \\
  --repo-url https://github.com/owner/repo \\
  --create-pr

πŸ“– Usage Guide

CLI Commands

Discover Issues:

python scripts/cli.py discover https://github.com/owner/repo --limit 10

Solve with Approval:

python scripts/cli.py solve https://github.com/owner/repo --issue 42
# Shows confidence score, diff preview, asks for approval

Auto-Approve (CI mode):

python scripts/cli.py solve https://github.com/owner/repo --issue 42 --no-confirm

Check Status:

python scripts/cli.py status

GitHub Action

Add .github/workflows/openfix.yml:

name: OpenFix
on:
  issues:
    types: [labeled]

jobs:
  fix:
    if: contains(github.event.issue.labels.*.name, 'openfix')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: CodeRustyPro/openfix-action@v1
        with:
          gemini-api-key: \${{ secrets.GEMINI_API_KEY }}
          github-token: \${{ secrets.GITHUB_TOKEN }}

Label any issue with openfix and the bot automatically generates a fix!


πŸ”§ Configuration

Environment Variables

  • GEMINI_API_KEY - Required for AI patch generation
  • GITHUB_TOKEN - Required for PR creation, optional for read-only operations

Config File

Edit config/config.yml:

llm:
  model: "gemini-2.0-flash-exp"
  temperature: 0.3
  max_retries: 2

validation:
  enabled: true
  timeout: 300

patch:
  max_files: 5
  confidence_threshold: 60

πŸ“Š Confidence Scoring

OpenFix calculates a 0-100 confidence score for each patch:

Score Risk Recommendation
75-100 Low High confidence - Consider auto-merge
50-74 Medium Review recommended
0-49 High Manual review required

Scoring Factors:

  • Triage Priority (25%)
  • Issue Complexity (20%)
  • Validation Results (35%)
  • Repair Iterations (20%)

πŸ§ͺ Testing

Sandbox Testing

# Create test repository
python scripts/setup_sandbox.py

# Follow instructions to create GitHub repo
# Then test OpenFix on it

Run Tests

# Unit tests
pytest tests/unit/

# Full test suite
pytest tests/ -v --cov=.

πŸ›‘οΈ Safety Features

  • βœ… Draft PRs Only - Never auto-merges
  • βœ… AI Disclosure - Clear attribution in every PR
  • βœ… Review Checklist - Ensures human oversight
  • βœ… Risk Labeling - High-risk patches clearly marked
  • βœ… Validation - Automated testing before PR creation

πŸ—οΈ Architecture

OpenFix Pipeline:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Discover  β”‚ β†’ Scan repo for issues
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚   Triage    β”‚ β†’ Filter & rank by suitability
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚  Generate   β”‚ β†’ AI creates patch
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚  Validate   β”‚ β†’ Run tests & checks
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚   Repair    β”‚ β†’ Refine based on feedback
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚ Create PR   β”‚ β†’ Draft PR with disclosure
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments


πŸ“§ Support


Made with ❀️ by CodeRustyPro

About

Agentic GitHub issue solver that automatically discovers bugs, generates patches, and creates pull requests.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published