CoolFace
Apppublic

RAHUL-13/bug-report-structuring-env

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
README.md191 linesDownload Raw Back to root
1---2title: Bug Report Structuring Env3emoji: "\U0001F41B"4colorFrom: red5colorTo: yellow6sdk: docker7pinned: false8---9 10# Bug Report Structuring Environment11 12An **OpenEnv** environment that challenges LLM agents to convert messy, unstructured bug reports into well-organized, structured formats.13 14## Overview15 16Bug reports in the wild are often poorly written โ€” missing steps, ambiguous descriptions, wrong severity labels, and scattered technical details. This environment tests an LLM agent's ability to:17 181. **Extract** key information from noisy text192. **Classify** severity accurately based on impact203. **Structure** reproduction steps in a clear, actionable format214. **Identify** environment details (OS, browser, versions)225. **Handle** compound reports with multiple distinct issues23 24## Tasks25 26| Task | Difficulty | Max Steps | Description |27|------|-----------|-----------|-------------|28| `easy` | ๐ŸŸข Easy | 3 | Single clear bug, all info present but messy |29| `medium` | ๐ŸŸก Medium | 4 | Multiple symptoms, ambiguity, partial info |30| `hard` | ๐Ÿ”ด Hard | 5 | Multiple distinct bugs, technical details |31 32## API Endpoints33 34| Method | Endpoint | Description |35|--------|----------|-------------|36| `POST` | `/reset` | Start a new episode with `{"task_id": "easy\|medium\|hard"}` |37| `POST` | `/step` | Submit structured report, get score + feedback |38| `GET` | `/state` | Get current episode metadata |39| `GET` | `/health` | Health check |40| `GET` | `/docs` | Interactive API documentation |41 42## Action Space43 44The agent submits a structured bug report as a JSON object via `POST /step`:45 46```json47{48  "action": {49    "title": "Clear, concise bug title",50    "steps_to_reproduce": "1. Step one\n2. Step two\n...",51    "expected_behavior": "What should happen",52    "actual_behavior": "What actually happens",53    "severity": "low|medium|high|critical",54    "environment": "OS, browser, version info",55    "additional_notes": "Any other relevant details"56  }57}58```59 60| Field | Type | Description |61|-------|------|-------------|62| `title` | string | Clear, concise summary of the bug |63| `steps_to_reproduce` | string | Numbered step-by-step reproduction instructions |64| `expected_behavior` | string | What the correct behavior should be |65| `actual_behavior` | string | What actually happens (the bug) |66| `severity` | string | One of: `low`, `medium`, `high`, `critical` |67| `environment` | string | OS, browser, version, platform details |68| `additional_notes` | string | Any other relevant information |69 70## Observation Space71 72After each `reset()` or `step()`, the environment returns an observation:73 74```json75{76  "raw_report": "The messy, unstructured bug report text...",77  "feedback": "Grading feedback explaining the score",78  "score": 0.85,79  "field_scores": {80    "title": 1.0,81    "steps_to_reproduce": 0.75,82    "expected_behavior": 0.5,83    "actual_behavior": 0.8,84    "severity": 1.0,85    "environment": 1.0,86    "format": 0.8387  },88  "done": false,89  "reward": 0.85,90  "step_count": 1,91  "task_id": "easy",92  "max_steps": 393}94```95 96| Field | Type | Description |97|-------|------|-------------|98| `raw_report` | string | The original messy bug report to structure |99| `feedback` | string | Human-readable grading feedback |100| `score` | float | Overall score from 0.0 to 1.0 |101| `field_scores` | dict | Per-field scores (0.0โ€“1.0 each) |102| `done` | bool | Whether the episode is complete |103| `reward` | float | Reward signal for this step |104| `step_count` | int | Current step number |105| `task_id` | string | Current task identifier |106| `max_steps` | int | Maximum steps allowed |107 108## Scoring109 110Reports are graded on 7 dimensions (each 0.0โ€“1.0):111 112| Dimension | Weight | What's Evaluated |113|-----------|--------|------------------|114| Title | 15% | Clarity and descriptiveness |115| Steps to Reproduce | 25% | Completeness and specificity |116| Expected Behavior | 15% | Accuracy of expected state |117| Actual Behavior | 15% | Accuracy of reported symptoms |118| Severity | 15% | Correct classification |119| Environment | 10% | Platform/version extraction |120| Format | 5% | Structural completeness |121 122**Partial credit** is awarded based on keyword coverage โ€” you don't need a perfect match to earn points.123 124## Quick Start125 126### Run Locally127 128```bash129pip install -r requirements.txt130python app.py131# Server runs at http://localhost:7860132```133 134### Docker135 136```bash137docker build -t bug-report-env .138docker run -p 7860:7860 bug-report-env139```140 141### Run Inference142 143```bash144export API_BASE_URL="https://api-inference.huggingface.co/v1"145export MODEL_NAME="meta-llama/Llama-3.1-8B-Instruct"146export HF_TOKEN="hf_your_token_here"147export ENV_URL="https://your-space.hf.space"148 149python inference.py150```151 152## Project Structure153 154```155โ”œโ”€โ”€ app.py              # FastAPI server with all endpoints156โ”œโ”€โ”€ environment.py      # Core environment logic (reset/step/state)157โ”œโ”€โ”€ models.py           # Pydantic request/response models158โ”œโ”€โ”€ tasks.py            # Task definitions with ground truth159โ”œโ”€โ”€ graders.py          # Deterministic grading logic160โ”œโ”€โ”€ inference.py        # LLM agent inference script161โ”œโ”€โ”€ openenv.yaml        # OpenEnv environment manifest162โ”œโ”€โ”€ Dockerfile          # Container definition for HF Spaces163โ”œโ”€โ”€ requirements.txt    # Python dependencies164โ””โ”€โ”€ README.md           # This file165```166 167## Environment Variables168 169| Variable | Description | Required |170|----------|-------------|----------|171| `API_BASE_URL` | LLM API base URL | For inference |172| `MODEL_NAME` | LLM model identifier | For inference |173| `HF_TOKEN` | Hugging Face token | For inference |174| `ENV_URL` | Deployed environment URL | For inference |175| `PORT` | Server port (default: 7860) | Optional |176 177## Deployment178 179This environment is designed for deployment on **Hugging Face Spaces** using Docker SDK:180 1811. Create a new Space on Hugging Face (Docker SDK)1822. Push the project files1833. The Space will build and serve automatically on port 7860184 185## Technical Details186 187- **No external dependencies**: The grading is fully deterministic using keyword matching โ€” no LLM needed server-side188- **Concurrent sessions**: Supports multiple simultaneous agents189- **Reward shaping**: First step gets full score as reward; subsequent steps reward improvement only190- **Runtime**: Well under the 20-minute limit on 2 vCPU / 8GB RAM191