File size: 4,128 Bytes
5cdf996
 
 
 
 
 
711b9b5
 
5cdf996
 
06aac03
 
339abf5
06aac03
5cd5f02
54e0639
339abf5
54e0639
5cd5f02
06aac03
5cd5f02
 
 
dda0d73
5cd5f02
06aac03
5cd5f02
06aac03
5cd5f02
06aac03
5cd5f02
 
 
 
 
06aac03
5cd5f02
06aac03
5cd5f02
 
 
 
 
 
 
 
06aac03
711b9b5
06aac03
711b9b5
06aac03
711b9b5
5cd5f02
 
06aac03
711b9b5
06aac03
711b9b5
5cd5f02
 
06aac03
711b9b5
06aac03
711b9b5
5cd5f02
 
 
 
06aac03
5cd5f02
54e0639
5cd5f02
 
 
 
 
 
 
54e0639
5cd5f02
06aac03
5cd5f02
 
 
 
cfe0896
75ca235
dda0d73
 
 
 
54e0639
5cd5f02
cfe0896
5cd5f02
cfe0896
 
711b9b5
cfe0896
 
711b9b5
54e0639
 
711b9b5
75ca235
cfe0896
 
711b9b5
cfe0896
711b9b5
 
75ca235
711b9b5
54e0639
5cd5f02
54e0639
 
711b9b5
54e0639
 
75ca235
 
 
 
 
 
 
 
5cd5f02
06aac03
5cd5f02
06aac03
711b9b5
 
06aac03
 
75ca235
 
 
 
5cd5f02
06aac03
711b9b5
dda0d73
711b9b5
 
 
 
06aac03
711b9b5
cfe0896
5cd5f02
06aac03
5cd5f02
 
711b9b5
06aac03
75ca235
 
 
 
 
 
 
 
 
5cd5f02
06aac03
711b9b5
 
75ca235
06aac03
 
339abf5
 
06aac03
339abf5
 
06aac03
dda0d73
 
 
 
5cd5f02
06aac03
5cd5f02
06aac03
711b9b5
5cd5f02
06aac03
 
5cd5f02
06aac03
711b9b5
 
 
cfe0896
5cd5f02
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
---
title: Bug Triage OpenEnv
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
tags:
  - openenv
---

# Bug Triage OpenEnv

A typed OpenEnv environment for software bug triage. The agent must classify tickets, assign them to the right team, detect duplicates, request missing information, and escalate urgent incidents.

## Why this environment

This is a real workflow, not a toy task. Software teams do bug triage every day, and progress can be measured step by step. The medium and hard tasks use varied, natural-language tickets instead of repeating a single template.

The environment includes:

- Typed `Observation`, `Action`, `Reward`, and `State` models with Pydantic
- Standard OpenEnv methods: `reset()`, `step()`, and `state()`
- Three deterministic tasks: easy, medium, and hard
- Programmatic graders with final task scores strictly in `(0, 1)`
- Dense rewards for partial progress

## Observation and action space

Observation includes:

- Current ticket details
- Queue stats
- Available teams and components
- Steps used and remaining
- Partial score and last action result

Actions supported:

- `classify`
- `assign`
- `mark_duplicate`
- `request_info`
- `defer`
- `close`
- `escalate_incident`
- `next_ticket`

## Tasks

### `bug_triage_easy`

- Difficulty: easy
- 8 tickets
- Mostly clear bug reports with minimal duplicates

### `bug_triage_medium`

- Difficulty: medium
- 15 tickets
- Mixed-quality reports with duplicates and missing information

### `bug_triage_hard`

- Difficulty: hard
- 25 tickets
- Noisy tickets with SLA pressure and escalation trade-offs

## Reward and grading

The reward function gives feedback during the episode, not only at the end.

It rewards:

- Correct severity, priority, and component classification
- Correct team assignment
- Correct duplicate handling
- Correct information requests
- Correct escalation of critical tickets

It penalizes:

- Invalid actions
- Repeated loop behavior
- Missing escalation on critical tickets
- Incorrect close or defer decisions

Each task has deterministic grader logic in `server/graders/`.
For validator compatibility, final task scores are epsilon-clamped to a strict open interval:

- minimum: `> 0.0`
- maximum: `< 1.0`

## Setup

Install dependencies:

```bash
python -m venv venv
```

Windows PowerShell:

```powershell
venv\Scripts\Activate.ps1
pip install -r server/requirements.txt
```

macOS/Linux:

```bash
source venv/bin/activate
pip install -r server/requirements.txt
```

Validate:

```bash
openenv validate
```

Configure submission variables (required by `inference.py`):

```bash
API_BASE_URL=https://router.huggingface.co/v1
MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
HF_TOKEN=<your_hf_token>
```

## Run locally

Start the API:

```bash
uvicorn server.app:app --host 0.0.0.0 --port 7860
```

Web UI:

- Open `http://127.0.0.1:7860/` (served from `static/`)

Main endpoints:

- `GET /reset`
- `POST /reset` (accepts empty body and optional JSON body)
- `POST /step`
- `GET /state`
- `GET /tasks`
- `GET /health`

## Baseline inference

Submission runner:

```bash
python inference.py
```

`inference.py` emits strict structured stdout logs in this order only:

- `[START] ...`
- `[STEP] ...` (one line per call to `step()`)
- `[END] ...`

By default, `action=` uses a compact human-readable format for easier scanning.
Set `OPENENV_LOG_ACTION_JSON=1` to emit raw JSON action payloads instead.

Deterministic offline baseline:

```powershell
$env:OPENENV_OFFLINE = "1"
venv\Scripts\python.exe inference.py
```

Offline baseline snapshots are computed from the current shared policy and task fixtures.
Use either of these to inspect live scores instead of relying on stale hardcoded numbers:

- `python inference.py` with `OPENENV_OFFLINE=1`
- `GET /baseline`

Submission check note:

- Ensure every task score is strictly between `0` and `1` (not exactly `0.0` or `1.0`).

## Docker and Hugging Face

Build:

```bash
docker build -t bug-triage-openenv .
```

Run:

```bash
docker run --rm -p 7860:7860 bug-triage-openenv
```

This repo is set up for a Docker-based Hugging Face Space and tagged with `openenv`.