-
Notifications
You must be signed in to change notification settings - Fork 174
Env/maze env #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Env/maze env #339
Conversation
Greptile OverviewGreptile SummaryThis PR adds a new Maze environment to OpenEnv, implementing a gridworld navigation task where an agent must reach an exit cell while avoiding walls. Key Changes:
Architecture:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as MazeEnv Client
participant WS as WebSocket Connection
participant Server as FastAPI Server
participant Env as MazeEnvironment
participant Maze as Maze Core Logic
Client->>Server: Connect WebSocket
Server->>Env: Create environment instance
Env->>Maze: Initialize maze (start_cell, exit_cell)
Maze-->>Env: Maze initialized
Server-->>Client: Connection established
Client->>WS: reset() message
WS->>Server: Forward reset request
Server->>Env: reset(seed, start_cell)
Env->>Maze: reset(start_cell)
Maze->>Maze: Reset agent position, clear visited cells
Maze-->>Env: Initial state
Env->>Env: Build MazeObservation (legal_actions, position, metadata)
Env-->>Server: MazeObservation with reward=0
Server-->>WS: Serialize observation
WS-->>Client: StepResult with observation
Client->>WS: step(MazeAction) message
WS->>Server: Forward action
Server->>Env: step(MazeAction)
Env->>Maze: step(action_id)
Maze->>Maze: Execute move, calculate reward
Note over Maze: Penalties: -0.05 (move)<br/>-0.25 (revisit)<br/>-0.75 (wall)<br/>Reward: +10.0 (exit)
Maze->>Maze: Check status (WIN/LOSE/PLAYING)
Maze-->>Env: state, reward, status
Env->>Env: Build MazeObservation with updated position
Env->>Env: Update internal state (step_count, done)
Env-->>Server: MazeObservation with reward, done
Server-->>WS: Serialize observation
WS-->>Client: StepResult
Client->>WS: state() message
WS->>Server: Forward state request
Server->>Env: Get state property
Env-->>Server: MazeState (episode_id, step_count, position, status)
Server-->>WS: Serialize state
WS-->>Client: MazeState
Client->>WS: close()
WS->>Server: Disconnect
Server->>Env: Cleanup session
Env-->>Server: Session closed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
envs/maze_env/models.py
Outdated
| done: bool = False | ||
| current_position: List[int] = Field(default_factory=list) | ||
| exit_cell: List[int] = Field(default_factory=list) | ||
| status : str = "playing" # e.g., "playing", "win", "lose" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before colon breaks Python syntax
| status : str = "playing" # e.g., "playing", "win", "lose" | |
| status: str = "playing" # e.g., "playing", "win", "lose" |
Prompt To Fix With AI
This is a comment left during a code review.
Path: envs/maze_env/models.py
Line: 56:56
Comment:
Space before colon breaks Python syntax
```suggestion
status: str = "playing" # e.g., "playing", "win", "lose"
```
How can I resolve this? If you propose a fix, please make it concise.| step_count=payload.get("step_count", 0), | ||
| done=payload.get("done", False), | ||
| current_position=payload.get("current_position", []), | ||
| exit_cell=payload.get("exit_cell", []), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before = breaks Python syntax
| exit_cell=payload.get("exit_cell", []), | |
| status=payload.get("status", "playing"), |
Prompt To Fix With AI
This is a comment left during a code review.
Path: envs/maze_env/client.py
Line: 113:113
Comment:
Space before `=` breaks Python syntax
```suggestion
status=payload.get("status", "playing"),
```
How can I resolve this? If you propose a fix, please make it concise.|
@Darktex could you review this env |
Summary
Maze Environment addition: navigates to the exit cell, with test cases and github workflow for the env
Type of Change
Alignment Checklist
Before submitting, verify:
.claude/docs/PRINCIPLES.mdand this PR aligns with our principles.claude/docs/INVARIANTS.mdand no invariants are violated/pre-submit-pr(orbash .claude/hooks/lint.shand tests) and addressed all issuesRFC Status
Test Plan
Follow README
and run test cases
Claude Code Review
NA