# levi178u/meta-x-hf-hackathon architecture

> Architecture diagram of the GitHub repository levi178u/meta-x-hf-hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/levi178u/meta-x-hf-hackathon
- Repository: https://github.com/levi178u/meta-x-hf-hackathon

## Overview

Code Review OpenEnv is an RL environment for training agents to review simulated code diffs. An agent starts an easy, medium, or hard episode, receives snippets, submits classifications and optionally severity, line, and comment judgments, then receives per-step rewards and a final grade. The HTTP API wraps the environment; a Python client and an inference runner can drive it. The README documents the task tiers and grading criteria. The sampled source shows API-to-environment calls and inference HTTP requests; dataset and grader details are documented, but their complete implementation was not sampled.

Main entry points: [`Code-Rev-Env/server/environment.py`](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py) (Episode environment), [`Code-Rev-Env/server/app.py`](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/app.py) (Environment API), [`Code-Rev-Env/inference.py`](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/inference.py) (Episode runner), [`Code-Rev-Env/client.py`](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/client.py) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interfaces"]
  node_api["Environment API<br/>[app.py]"]
  node_hf_entry["Spaces entrypoint<br/>[app.py]"]
  node_client["HTTP client<br/>[client.py]"]
  node_contracts["Action and state models<br/>[models.py]"]
end

subgraph group_runtime["Environment runtime"]
  node_environment["Episode environment<br/>[environment.py]"]
  node_snippet_data["Snippet dataset<br/>[environment.py]"]
  node_episode_queue["Episode queue<br/>[environment.py]"]
end

subgraph group_evaluation["Review evaluation"]
  node_reward_calc["Step reward scoring<br/>[environment.py]"]
  node_task_graders["Task graders<br/>[environment.py]"]
end

subgraph group_agent["Agent inference"]
  node_inference_runner["Episode runner<br/>[inference.py]"]
  node_review_strategy["LLM and rule review<br/>[inference.py]"]
end

node_agent_user(("Review agent"))
node_llm_service{{"LLM API"}}

node_agent_user -->|"submits reviews"| node_client
node_client -->|"sends HTTP requests"| node_api
node_agent_user -.->|"uses endpoints"| node_api
node_api -->|"resets, steps, grades"| node_environment
node_hf_entry -->|"serves environment API"| node_environment
node_environment -.->|"loads snippets"| node_snippet_data
node_environment -.->|"manages episode queue"| node_episode_queue
node_environment -->|"computes step reward"| node_reward_calc
node_environment -->|"selects task grader"| node_task_graders
node_agent_user -.->|"starts evaluation"| node_inference_runner
node_inference_runner -->|"resets and submits steps"| node_api
node_inference_runner -->|"requests review"| node_review_strategy
node_review_strategy -->|"requests completions"| node_llm_service

click node_api "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/app.py"
click node_hf_entry "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/app.py"
click node_client "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/client.py"
click node_contracts "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/models.py"
click node_environment "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py"
click node_snippet_data "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py"
click node_episode_queue "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py"
click node_reward_calc "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py"
click node_task_graders "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py"
click node_inference_runner "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/inference.py"
click node_review_strategy "https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/inference.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_hf_entry,node_client,node_contracts,node_agent_user toneBlue
class node_environment,node_snippet_data,node_episode_queue toneAmber
class node_reward_calc,node_task_graders,node_llm_service toneMint
class node_inference_runner,node_review_strategy toneRose
```

## Components

### Interfaces

- [Environment API](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/app.py): `Code-Rev-Env/server/app.py`
- [Spaces entrypoint](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/app.py): `Code-Rev-Env/app.py`
- [HTTP client](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/client.py): `Code-Rev-Env/client.py`
- [Action and state models](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/models.py): `Code-Rev-Env/models.py`

### Environment runtime

- [Episode environment](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py): `Code-Rev-Env/server/environment.py`
- [Snippet dataset](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py): `Code-Rev-Env/server/environment.py`
- [Episode queue](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py): `Code-Rev-Env/server/environment.py`

### Review evaluation

- [Step reward scoring](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py): `Code-Rev-Env/server/environment.py`
- [Task graders](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/server/environment.py): `Code-Rev-Env/server/environment.py`

### Agent inference

- [Episode runner](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/inference.py): `Code-Rev-Env/inference.py`
- [LLM and rule review](https://github.com/levi178u/meta-x-hf-hackathon/blob/main/Code-Rev-Env/inference.py): `Code-Rev-Env/inference.py`

### Other components

- **Review agent**
- **LLM API**

## Connections

- Review agent → HTTP client: submits reviews (evidence: `Code-Rev-Env/client.py`)
- HTTP client → Environment API: sends HTTP requests (evidence: `Code-Rev-Env/client.py`)
- Review agent → Environment API: uses endpoints (evidence: `README.md`)
- Environment API → Episode environment: resets, steps, grades (evidence: `Code-Rev-Env/server/app.py`)
- Spaces entrypoint → Episode environment: serves environment API (evidence: `Code-Rev-Env/app.py`)
- Episode environment → Snippet dataset: loads snippets (evidence: `README.md`)
- Episode environment → Episode queue: manages episode queue (evidence: `README.md`)
- Episode environment → Step reward scoring: computes step reward (evidence: `Code-Rev-Env/server/environment.py`)
- Episode environment → Task graders: selects task grader (evidence: `Code-Rev-Env/server/environment.py`)
- Review agent → Episode runner: starts evaluation (evidence: `README.md`)
- Episode runner → Environment API: resets and submits steps (evidence: `Code-Rev-Env/inference.py`)
- Episode runner → LLM and rule review: requests review (evidence: `Code-Rev-Env/inference.py`)
- LLM and rule review → LLM API: requests completions (evidence: `Code-Rev-Env/inference.py`)
