CoolFace
Apppublic

AmitSJ/github-issue-triage

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
App README

๐Ÿ™ GitHub Issue Triage โ€” OpenEnv Environment

MetaXScaler ร— Meta ร— PyTorch ร— Hugging Face Hackathon 2026 An OpenEnv-compatible reinforcement learning environment where AI agents learn to triage GitHub issues.

![OpenEnv](https://openenv.dev) ![Python](https://python.org) ![FastAPI](https://fastapi.tiangolo.com) ![License](LICENSE)


๐ŸŽฏ What This Is

Open-source projects receive thousands of GitHub issues daily โ€” bugs, feature requests, questions, duplicates. Maintainers spend 4โ€“8 hours per day just on triage: classifying, prioritizing, routing, and estimating effort for each issue.

This project builds an OpenEnv-compatible RL training environment where AI agents can learn to automate this process. Agents interact with realistic simulated GitHub issues and receive reward signals for making accurate triage decisions.

The core idea:

Agent reads issue โ†’ Makes triage decisions โ†’ Gets reward (0.0โ€“1.0) โ†’ Learns to improve

๐Ÿ—๏ธ Architecture

github-issue-triage-env/
โ”œโ”€โ”€ env/
โ”‚   โ”œโ”€โ”€ models.py             # Typed Pydantic models (observation + action spaces)
โ”‚   โ”œโ”€โ”€ issue_generator.py    # 50 realistic synthetic GitHub issues
โ”‚   โ”œโ”€โ”€ rewards.py            # Partial reward functions (0.0โ€“1.0)
โ”‚   โ”œโ”€โ”€ tasks.py              # 3 task definitions + graders
โ”‚   โ””โ”€โ”€ environment.py        # Core engine: reset() / step() / state()
โ”œโ”€โ”€ static/
โ”‚   โ””โ”€โ”€ dashboard.html        # Visual web UI at /dashboard
โ”œโ”€โ”€ app.py                    # FastAPI server (exposes HTTP endpoints)
โ”œโ”€โ”€ baseline.py               # Rule-based baseline agent
โ”œโ”€โ”€ openenv.yaml              # OpenEnv specification config
โ”œโ”€โ”€ Dockerfile                # Container configuration
โ””โ”€โ”€ requirements.txt          # Python dependencies

๐ŸŽฎ The 3 Tasks

TaskNameDifficultyStepsFields Graded
task_1Issue Classification๐ŸŸข Easy10issue_type
task_2Priority Assignment๐ŸŸก Medium8issue_type + priority
task_3Full Triage๐Ÿ”ด Hard6All 4 fields (weighted)

Task 3 Scoring Weights

issue_type   โ†’ 25%
priority     โ†’ 30%   (most critical โ€” wrong priority = wrong escalation)
team         โ†’ 30%   (most critical โ€” wrong team = issue ignored)
effort       โ†’ 15%

๐Ÿ”€ Observation Space

What the agent sees each step:

json
{
  "issue_id":          "issue_042",
  "title":             "App crashes on startup after v3.2 update",
  "body":              "## Bug Report\n1,200 crash reports in 2 hours...",
  "repo":              "mobile-app",
  "author_type":       "regular",
  "user_reports":      1200,
  "existing_labels":   [],
  "open_issues_count": 340,
  "task_id":           "task_1",
  "step_number":       3
}

โšก Action Space

What the agent does each step:

json
{
  "issue_type":       "bug",        
  "priority":         "P1",         
  "team":             "backend",    
  "estimated_effort": "small"       
}

Allowed values:

  • โ€”issue_type: bug | feature | question | documentation | duplicate
  • โ€”priority: P1 (Critical) | P2 (High) | P3 (Medium) | P4 (Low)
  • โ€”team: backend | frontend | devops | documentation | security | support
  • โ€”estimated_effort: small | medium | large

๐Ÿ† Reward Function

python
# Task 1 โ€” Binary (issue type only)
exact_match โ†’ 1.0  |  wrong โ†’ 0.0

# Task 2 โ€” Weighted average
(type_score ร— 0.5) + (priority_score ร— 0.5)

# Task 3 โ€” Fully weighted
(type ร— 0.25) + (priority ร— 0.30) + (team ร— 0.30) + (effort ร— 0.15)

Partial rewards for priority:

Exact match  โ†’ 1.0
1 level off  โ†’ 0.5   (P1 vs P2 โ€” close, partial credit)
2 levels off โ†’ 0.2
3+ levels    โ†’ 0.0

๐Ÿš€ Quick Start

1. Clone and Install

bash
git clone https://github.com/yourusername/github-issue-triage-env
cd github-issue-triage-env
pip install -r requirements.txt

2. Start the Server

bash
python app.py

Server starts at: http://localhost:7860

3. Open the Dashboard

Visit: http://localhost:7860/dashboard

Interactive visual UI โ€” select a task, start an episode, submit triage decisions!

4. Explore the API

Visit: http://localhost:7860/docs

Swagger UI with interactive API testing for all endpoints.

5. Run Baseline Agent

bash
# In a second terminal (server must be running):
python baseline.py

๐Ÿ“ก API Endpoints

MethodEndpointDescription
GET/Welcome message + endpoint list
POST/resetStart a new episode
POST/stepSubmit a triage action
GET/stateGet current episode metadata
GET/healthHealth check
GET/docsSwagger UI (interactive API docs)
GET/dashboardVisual web UI

Example: Full Episode via API

bash
# 1. Start episode
curl -X POST http://localhost:7860/reset \
  -H "Content-Type: application/json" \
  -d '{"task_id": "task_3"}'

# 2. Submit action
curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{
    "issue_type": "bug",
    "priority": "P1",
    "team": "backend",
    "estimated_effort": "small"
  }'

# 3. Check state
curl http://localhost:7860/state

๐Ÿค– Baseline Results

The included baseline.py uses simple keyword matching to demonstrate reproducible scores:

TaskScore
Task 1 โ€” Issue Classification (Easy)~0.70
Task 2 โ€” Priority Assignment (Medium)~0.52
Task 3 โ€” Full Triage (Hard)~0.38
Overall~0.53
A trained RL agent would significantly outperform these baseline scores.

๐Ÿณ Docker

bash
# Build the container
docker build -t github-issue-triage .

# Run the container
docker run -p 7860:7860 github-issue-triage

# Access at http://localhost:7860

๐Ÿ’ก Why This Project?

ProblemOur Solution
Maintainers spend 8hrs/day on triageAI agent handles it in milliseconds
Existing tools use static rules (no learning)RL environment โ€” agents continuously improve
No standard training ground existedOpenEnv-compatible gym for triage agents
Real GitHub API has rate limitsReproducible synthetic dataset (50 issues)

๐Ÿ”ฎ Future Extensions

  • โ€”๐Ÿ”— Connect to real GitHub API for live issue data
  • โ€”๐ŸŒ Multilingual issue support (Hindi, Spanish, French)
  • โ€”๐Ÿค Multi-agent mode (one classifies, another reviews)
  • โ€”๐Ÿ“ˆ Leaderboard for competing agents
  • โ€”๐Ÿ”ฎ LLM-powered agent backbone (GPT / LLaMA)

๐Ÿ› ๏ธ Tech Stack

ComponentTechnology
API ServerFastAPI + Uvicorn
Data ModelsPydantic v2
EnvironmentPython 3.11
DashboardHTML + Vanilla JS
ConfigYAML
DeploymentDocker + Hugging Face Spaces

๐Ÿ“„ License

MIT License โ€” free to use, modify, and distribute.


Built for MetaXScaler ร— Meta ร— PyTorch ร— Hugging Face Hackathon 2026