CoolFace
Apppublic

RAHUL-13/bug-report-structuring-env

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

Bug Report Structuring Environment

An OpenEnv environment that challenges LLM agents to convert messy, unstructured bug reports into well-organized, structured formats.

Overview

Bug 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:

  1. 1.Extract key information from noisy text
  2. 2.Classify severity accurately based on impact
  3. 3.Structure reproduction steps in a clear, actionable format
  4. 4.Identify environment details (OS, browser, versions)
  5. 5.Handle compound reports with multiple distinct issues

Tasks

TaskDifficultyMax StepsDescription
easy๐ŸŸข Easy3Single clear bug, all info present but messy
medium๐ŸŸก Medium4Multiple symptoms, ambiguity, partial info
hard๐Ÿ”ด Hard5Multiple distinct bugs, technical details

API Endpoints

MethodEndpointDescription
POST/resetStart a new episode with `{"task_id": "easy\medium\hard"}`
POST/stepSubmit structured report, get score + feedback
GET/stateGet current episode metadata
GET/healthHealth check
GET/docsInteractive API documentation

Action Space

The agent submits a structured bug report as a JSON object via POST /step:

json
{
  "action": {
    "title": "Clear, concise bug title",
    "steps_to_reproduce": "1. Step one\n2. Step two\n...",
    "expected_behavior": "What should happen",
    "actual_behavior": "What actually happens",
    "severity": "low|medium|high|critical",
    "environment": "OS, browser, version info",
    "additional_notes": "Any other relevant details"
  }
}
FieldTypeDescription
titlestringClear, concise summary of the bug
steps_to_reproducestringNumbered step-by-step reproduction instructions
expected_behaviorstringWhat the correct behavior should be
actual_behaviorstringWhat actually happens (the bug)
severitystringOne of: low, medium, high, critical
environmentstringOS, browser, version, platform details
additional_notesstringAny other relevant information

Observation Space

After each reset() or step(), the environment returns an observation:

json
{
  "raw_report": "The messy, unstructured bug report text...",
  "feedback": "Grading feedback explaining the score",
  "score": 0.85,
  "field_scores": {
    "title": 1.0,
    "steps_to_reproduce": 0.75,
    "expected_behavior": 0.5,
    "actual_behavior": 0.8,
    "severity": 1.0,
    "environment": 1.0,
    "format": 0.83
  },
  "done": false,
  "reward": 0.85,
  "step_count": 1,
  "task_id": "easy",
  "max_steps": 3
}
FieldTypeDescription
raw_reportstringThe original messy bug report to structure
feedbackstringHuman-readable grading feedback
scorefloatOverall score from 0.0 to 1.0
field_scoresdictPer-field scores (0.0โ€“1.0 each)
doneboolWhether the episode is complete
rewardfloatReward signal for this step
step_countintCurrent step number
task_idstringCurrent task identifier
max_stepsintMaximum steps allowed

Scoring

Reports are graded on 7 dimensions (each 0.0โ€“1.0):

DimensionWeightWhat's Evaluated
Title15%Clarity and descriptiveness
Steps to Reproduce25%Completeness and specificity
Expected Behavior15%Accuracy of expected state
Actual Behavior15%Accuracy of reported symptoms
Severity15%Correct classification
Environment10%Platform/version extraction
Format5%Structural completeness

Partial credit is awarded based on keyword coverage โ€” you don't need a perfect match to earn points.

Quick Start

Run Locally

bash
pip install -r requirements.txt
python app.py
# Server runs at http://localhost:7860

Docker

bash
docker build -t bug-report-env .
docker run -p 7860:7860 bug-report-env

Run Inference

bash
export API_BASE_URL="https://api-inference.huggingface.co/v1"
export MODEL_NAME="meta-llama/Llama-3.1-8B-Instruct"
export HF_TOKEN="hf_your_token_here"
export ENV_URL="https://your-space.hf.space"

python inference.py

Project Structure

โ”œโ”€โ”€ app.py              # FastAPI server with all endpoints
โ”œโ”€โ”€ environment.py      # Core environment logic (reset/step/state)
โ”œโ”€โ”€ models.py           # Pydantic request/response models
โ”œโ”€โ”€ tasks.py            # Task definitions with ground truth
โ”œโ”€โ”€ graders.py          # Deterministic grading logic
โ”œโ”€โ”€ inference.py        # LLM agent inference script
โ”œโ”€โ”€ openenv.yaml        # OpenEnv environment manifest
โ”œโ”€โ”€ Dockerfile          # Container definition for HF Spaces
โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ””โ”€โ”€ README.md           # This file

Environment Variables

VariableDescriptionRequired
API_BASE_URLLLM API base URLFor inference
MODEL_NAMELLM model identifierFor inference
HF_TOKENHugging Face tokenFor inference
ENV_URLDeployed environment URLFor inference
PORTServer port (default: 7860)Optional

Deployment

This environment is designed for deployment on Hugging Face Spaces using Docker SDK:

  1. 1.Create a new Space on Hugging Face (Docker SDK)
  2. 2.Push the project files
  3. 3.The Space will build and serve automatically on port 7860

Technical Details

  • โ€”No external dependencies: The grading is fully deterministic using keyword matching โ€” no LLM needed server-side
  • โ€”Concurrent sessions: Supports multiple simultaneous agents
  • โ€”Reward shaping: First step gets full score as reward; subsequent steps reward improvement only
  • โ€”Runtime: Well under the 20-minute limit on 2 vCPU / 8GB RAM