om192006/github-issue-triage
1
1"""2models.py — GitHub Issue Triage Environment3Team Astra.AI: Om Chougule (Lead), Shraman Patil4 5Typed Pydantic models for Action, Observation, and State.6All fields documented for OpenEnv spec compliance.7"""8 9from typing import List, Optional10from openenv.core.env_server import Action, Observation, State11 12 13class GithubIssueTriageAction(Action):14 """15 The agent's triage decision for one GitHub issue.16 17 Fields:18 label — Required. Issue category. One of: bug | feature | docs | question19 team — Team to route to. One of: frontend | backend | ml | devops | docs20 Required for medium + hard tasks. Null for easy task.21 priority — Urgency level. One of: critical | high | medium | low22 Required for hard task only. Null for easy + medium.23 suggested_action — A brief, concrete action the assignee should take.24 Required for hard task only. Null for easy + medium.25 reasoning — One-sentence justification for the triage decision.26 Always encouraged; not graded but helps debugging.27 """28 29 label: str30 team: Optional[str] = None31 priority: Optional[str] = None32 suggested_action: Optional[str] = None33 reasoning: Optional[str] = None34 35 36class GithubIssueTriageObservation(Observation):37 """38 What the agent sees at each step.39 40 Fields:41 issue_id — GitHub issue number, e.g. "#105"42 issue_title — Title of the issue43 issue_body — Full body text of the issue44 repo_name — Repository the issue belongs to45 author — GitHub username who filed the issue46 existing_comments — List of comments already on the issue (context)47 task_id — Current task difficulty: easy | medium | hard48 task_description — Natural-language description of what the agent must do49 last_reward — Reward received from the previous step (0.0 on reset)50 feedback — Human-readable feedback from the last grader result51 step_number — Current step index within the episode52 """53 54 issue_id: str = ""55 issue_title: str = ""56 issue_body: str = ""57 repo_name: str = "meta-pytorch/OpenEnv"58 author: str = ""59 existing_comments: List[str] = []60 task_id: str = "easy"61 task_description: str = ""62 last_reward: float = 0.063 feedback: str = ""64 step_number: int = 065 66 67class GithubIssueTriageState(State):68 """69 Full internal state of the environment (not shown to agent).70 71 Fields:72 episode_id — Unique ID for this episode73 task_id — Current task difficulty74 issue_id — ID of the issue currently being triaged75 step_count — Total steps taken in this episode76 total_reward — Cumulative reward across all steps77 last_reward — Reward from the most recent step78 done — Whether the episode has ended79 """80 81 episode_id: str = ""82 task_id: str = "easy"83 issue_id: str = ""84 step_count: int = 085 total_reward: float = 0.086 last_reward: float = 0.087 done: bool = False