File size: 2,113 Bytes
103c3be
703aa57
23ec28c
38ab410
 
103c3be
 
2824eb9
38ab410
 
 
 
 
2824eb9
 
703aa57
 
 
 
2824eb9
23ec28c
38ab410
 
 
703aa57
 
 
 
 
2824eb9
 
 
 
 
23ec28c
38ab410
 
 
703aa57
38ab410
2824eb9
 
 
 
 
38ab410
703aa57
 
 
 
 
 
 
 
23ec28c
38ab410
103c3be
38ab410
 
95a7f62
703aa57
38ab410
 
 
103c3be
703aa57
103c3be
23ec28c
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
# model.py
from typing import List, Optional, Dict, Any
from pydantic import BaseModel, Field, ConfigDict
from openenv.core.env_server import Action, Observation
from openenv.core.env_server.types import State


class BugReport(BaseModel):
    """A single GitHub-style bug report."""
    id: str
    title: str
    body: str
    author: str
    labels_hint: List[str] = Field(default_factory=list)
    comments: List[str] = Field(default_factory=list)
    severity_signals: List[str] = Field(default_factory=list)
    related_bugs: List[str] = Field(default_factory=list)
    stack_trace: str = ""
    affected_component: str = ""

    model_config = ConfigDict(arbitrary_types_allowed=True)


class TriageAction(Action):
    """What the agent submits — either an investigation or a final triage decision."""
    action_type: str = "submit"     # "read_body" | "read_comments" | "check_logs" | "check_similar" | "submit"

    # Only used when action_type == "submit"
    priority: str = "P2"
    labels: List[str] = Field(default_factory=list)
    assigned_team: str = "backend"
    milestone: str = "backlog"
    reasoning: str = ""

    model_config = ConfigDict(arbitrary_types_allowed=True)


class TriageObservation(Observation):
    """What the agent sees after each step — progressively reveals info."""
    bug_report: BugReport
    task_id: str = "easy"
    score: float = 0.0
    feedback: str = ""
    done: bool = False
    reward: float = 0.0

    # Progressive visibility fields
    body_visible: bool = False
    comments_visible: bool = False
    logs_visible: bool = False
    similar_visible: bool = False
    steps_taken: int = 0
    max_steps: int = 6

    model_config = ConfigDict(arbitrary_types_allowed=True)


class TriageState(State):
    """Internal episode state."""
    episode_id: str = ""
    session_id: str = ""
    current_task: str = "easy"
    step_count: int = 0
    total_score: float = 0.0
    tasks_completed: List[str] = Field(default_factory=list)
    actions_taken: List[str] = Field(default_factory=list)

    model_config = ConfigDict(arbitrary_types_allowed=True)