YashR05/pullrequest-arena
0
1"""2Pydantic models for the PullRequest Arena environment.3 4ReviewAction — The structured action an AI agent returns after reviewing a PR.5 Supports four action types: approve, request_changes, comment, suggest_fix.6 The comment field contains the agent's explanation of any issues found.7 8PRObservation — The observation presented to the agent for each task.9 Contains all context needed to review a fake pull request: title, description,10 changed files, code diff, language, test/CI status, repository context,11 task metadata, and episode feedback (reward, done flag).12"""13 14from openenv.core.env_server.types import Action, Observation15from pydantic import Field, BaseModel16from typing import Optional17 18 19class ReviewAction(BaseModel):20 """21 Action format the agent must output to interact with the environment.22 """23 type: str = Field(description="Action type: approve, request_changes, comment, suggest_fix, submit_patch")24 comment: str = Field(description="Review comment text")25 patch: str | None = Field(default=None, description="The proposed code patch (only for submit_patch)")26 27 28class PRObservation(Observation):29 """Observation containing all pull-request context for a single review task."""30 31 pr_title: str = Field(default="")32 pr_description: str = Field(default="")33 files_changed: list = Field(default_factory=list)34 code_diff: str = Field(default="")35 language: str = Field(default="python")36 tests_passed: bool = Field(default=False)37 ci_logs: str = Field(default="")38 repository_context: str = Field(default="")39 test_results: dict | None = Field(default=None, description="Detailed breakdown of passed/failed tests")40 repo_tree: list[str] | None = Field(default=None, description="Current structure of files in the repo")41 previous_comments: list[str] | None = Field(default=None, description="Any previous human peer reviews on this PR")42 review_status: str | None = Field(default="pending", description="The current staging status of the PR")43 task_id: str = Field(default="")44 difficulty: str = Field(default="easy")45 feedback: str = Field(default="")46 done: bool = Field(default=False)47 reward: float = Field(default=0.01)48 