Skip to content

Feature: Integrate GitHub App with FastAPI backend for @euni-bot /fix #138

Description

@Wes1eyyy

Overview

Enable organization members to trigger automated code fixes by commenting @euni-bot /fix on issues or PRs. The GitHub App webhook should call the FastAPI backend, run the euni agent for code repair, and open a PR with results.


Tasks

  • Configuration

    • Add GH_APP_ID, GH_WEBHOOK_SECRET, GH_APP_PRIVATE_KEY, BOT_HANDLE, ORG_NAME to .env and load via configuration/github.py.
  • Utils

    • Implement signature verification, JWT creation, and command parsing in utils/github_sec.py.
  • GitHub Service Layer

    • Add git/github_service.py for:

      • Installation token retrieval
      • Org membership check
      • Comment posting/updating
      • Branch creation + commit + PR creation
  • AI Fix Logic

    • Add app/services/euni_fix.py with run_euni_fix(repo_dir, args) (placeholder for real AI/MCP integration).
  • Webhook Route

    • Add app/routes/github_webhook.py:

      • Validate webhook signature
      • Detect @BOT_HANDLE /fix
      • Post placeholder comment
      • Run background fix → commit → PR → update comment
  • App Initialization

    • Register webhook router in app/__init__.py.
  • Deployment

    • Update docker-compose.yml with env vars and uvicorn command.
    • Configure Nginx reverse proxy for /github/webhook with SSL.
  • Testing

    • Add tests/app/test_github_webhook.py (mock payload, check command parsing & response flow).

Acceptance Criteria

  • When a member comments @euni-bot /fix:

    • Bot posts a “started” placeholder.
    • After fix, bot updates comment with PR link and short summary.
  • Only members of ORG_NAME can trigger the command.

  • Errors are handled gracefully with a failure comment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions