Skip to content

Conversation

@shankerram3
Copy link

No description provided.

@meta-cla
Copy link

meta-cla bot commented Oct 28, 2025

Hi @shankerram3!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 28, 2025
@meta-cla
Copy link

meta-cla bot commented Oct 28, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Updated README with sample rendering code for wildfree simulation.
Added sections on wildfire simulation motivation, research goals, and citations to the README.
@shankerram3 shankerram3 changed the title New environment for the hackathon -Add Wildfire Environment for OpenEnv (FastAPI, RL-compatible) [ENVIRONMENT] -Add Wildfire Environment for OpenEnv (FastAPI, RL-compatible) Oct 28, 2025
@shankerram3 shankerram3 changed the title [ENVIRONMENT] -Add Wildfire Environment for OpenEnv (FastAPI, RL-compatible) [ENVIRONMENT] Wildfire Environment to simulate Wildfires for OpenEnv (FastAPI, RL-compatible) Oct 28, 2025
@Darktex Darktex requested a review from Copilot October 31, 2025 00:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new wildfire simulation environment to the OpenEnv framework. The environment models fire spread dynamics influenced by wind, humidity, and limited resources (water and firebreaks), enabling RL agents to learn fire containment strategies.

Key Changes

  • Implements WildfireEnvironment with physics-based fire spread mechanics including wind direction effects, humidity suppression, and multi-tick burn lifetime
  • Adds Docker containerization support with build scripts and Dockerfile for deployment
  • Provides client-side API with visualization utilities for rendering the grid state

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/envs/wildfire_env/server/wildfire_environment.py Core server implementation with fire spread logic, reward shaping, and action handling
src/envs/wildfire_env/models.py Data models for actions, observations, and state
src/envs/wildfire_env/client.py HTTP client implementation with grid rendering utility
src/envs/wildfire_env/server/app.py FastAPI application entry point
src/envs/wildfire_env/server/Dockerfile Docker container configuration
src/envs/wildfire_env/server/build_docker.sh Docker build script
src/envs/wildfire_env/README.md Comprehensive documentation with usage examples
src/envs/wildfire_env/__init__.py Package initialization and exports
src/envs/wildfire_env/server/__init__.py Server package initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 364 to 368
# --- Required abstract property implementation ---
@property
def state(self) -> WildfireState:
"""Return the current environment state."""
return self._state
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. Lines 364-368 have mixed indentation levels. Line 364 has excessive leading whitespace, line 367 has only 1 space of indentation instead of the expected 8 spaces for a method body. Standardize to use consistent 4-space indentation throughout.

Suggested change
# --- Required abstract property implementation ---
@property
def state(self) -> WildfireState:
"""Return the current environment state."""
return self._state
# --- Required abstract property implementation ---
@property
def state(self) -> WildfireState:
"""Return the current environment state."""
return self._state

Copilot uses AI. Check for mistakes.
burned_count: int # total ash (0) cells (cumulative)
reward_hint: float = 0.0
remaining_water: int = 0
remaining_breaks: int = 0# optional shaping info
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment '# optional shaping info' on line 28 is misplaced. It should be on line 26 or 27, or removed entirely since it doesn't accurately describe the resource fields on lines 27-28. The comment appears to be a leftover from line 26's reward_hint field.

Suggested change
remaining_breaks: int = 0# optional shaping info
remaining_breaks: int = 0

Copilot uses AI. Check for mistakes.
rows = []
for y in range(h):
rows.append("".join(legend.get(g[y*w+x], "?") for x in range(w)))
meta = f"step={obs.step} wind={obs.wind_dir} hum={obs.humidity:.2f} burning={obs.burning_count} burned= {obs.burned_count}"
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive whitespace after 'burned=' creates inconsistent spacing in the output string. Replace the multiple spaces with a single space for consistent formatting.

Suggested change
meta = f"step={obs.step} wind={obs.wind_dir} hum={obs.humidity:.2f} burning={obs.burning_count} burned= {obs.burned_count}"
meta = f"step={obs.step} wind={obs.wind_dir} hum={obs.humidity:.2f} burning={obs.burning_count} burned= {obs.burned_count}"

Copilot uses AI. Check for mistakes.
)

def _parse_state(self, payload: dict) -> WildfireState:
return WildfireState(**payload)
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing blank lines before function definition. PEP 8 requires two blank lines before top-level function definitions. Add a blank line between line 18 and line 19.

Suggested change
return WildfireState(**payload)
return WildfireState(**payload)

Copilot uses AI. Check for mistakes.
```

---
## Sample rendering to see wildfree simulation
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'wildfree' to 'wildfire'.

Suggested change
## Sample rendering to see wildfree simulation
## Sample rendering to see wildfire simulation

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,321 @@
import os
import random, uuid
from typing import List
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'List' is not used.

Suggested change
from typing import List

Copilot uses AI. Check for mistakes.
Comment on lines 4 to 5
from dataclasses import replace

Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'replace' is not used.

Suggested change
from dataclasses import replace

Copilot uses AI. Check for mistakes.

import os
import random, uuid
from typing import List
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'List' is not used.

Suggested change
from typing import List

Copilot uses AI. Check for mistakes.
import os
import random, uuid
from typing import List
from dataclasses import replace
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'replace' is not used.

Suggested change
from dataclasses import replace

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@Darktex Darktex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wowwww this is soo cool!!! Thank you for the contribution :)

I can see a few small things that we should change, but otherwise we are almost ready to land.

Also, could you add an example? examples/wildfire.py would be awesome...

@@ -0,0 +1,10 @@
# server/app.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, what does this directory do? .ipynb_checkpoints doesn't look like a directory that you wanna check in! :D


from IPython.display import clear_output, display
import matplotlib.colors as mcolors
sys.path.append("/workspace/OpenEnv/src")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded path

from ..models import WildfireAction, WildfireObservation
from .wildfire_environment import WildfireEnvironment

W = int(os.getenv("WILDFIRE_W", "16"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming is inconsistent, because in wildfire_environment.py you actually use WILDFIRE_WIDTH. Same thing for height

from envs.wildfire_env.server.wildfire_environment import WildfireEnvironment


client = WildfireEnv("http://localhost:8020")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use port 8000 for these examples

time.sleep(0.3)


res = client.step(WildfireAction(action="WAIT"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual action is lowercase "wait" though

import numpy as np
import time, sys

from IPython.display import clear_output, display
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is jupyter specific but won't work in standalone Python

remaining_breaks: int = 0# optional shaping info

@dataclass
class WildfireState(State):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add burn_timers here. They currently get added dynamically upon reset which breaks type safety

)

# per-cell burn timers (persist across steps)
self._state.burn_timers = [0] * (self.w * self.h)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment in models.py

claude and others added 3 commits November 2, 2025 01:33
This commit addresses all the review comments from PR meta-pytorch#108:

1. Remove .ipynb_checkpoints directories from version control
   - Deleted all checkpoint files that were accidentally committed

2. Fix hardcoded file paths in README
   - Removed hardcoded path: sys.path.append("/workspace/OpenEnv/src")
   - Changed port from 8020 to 8000 for consistency
   - Removed unnecessary import of WildfireEnvironment from example

3. Standardize environment variable naming
   - Changed WILDFIRE_W to WILDFIRE_WIDTH in server/app.py
   - Changed WILDFIRE_H to WILDFIRE_HEIGHT in server/app.py
   - Now consistent with documentation and other env vars

4. Fix action case consistency
   - Changed "WAIT" to "wait" in README example
   - Ensures consistency with lowercase action names

5. Add note about Jupyter-specific dependencies
   - Added note in README explaining IPython requirements
   - References new standalone example file

6. Add burn_timers to WildfireState dataclass
   - Added burn_timers field to models.py for type safety
   - Prevents runtime attribute assignment outside dataclass

7. Create examples/wildfire.py demonstration file
   - New standalone Python example without Jupyter dependencies
   - Demonstrates basic firefighting strategy
   - Includes visualization using render_grid function

8. Code cleanup
   - Fixed formatting in models.py (moved misplaced comment)
   - Removed unused imports (List, replace) from wildfire_environment.py
   - Improved import organization and PEP 8 compliance
   - Fixed typo: "wildfree" to "wildfire" in README

All changes maintain backward compatibility while improving
code quality and usability.
Address final Copilot AI review comments:

1. Add blank line before render_grid function (PEP 8)
   - Added two blank lines between class and module-level function

2. Fix excessive whitespace in client.py
   - Removed extra spaces after "burned=" in metadata string

3. Fix inconsistent indentation in wildfire_environment.py
   - Corrected state property indentation to use 4-space standard
   - Fixed comment alignment
   - Fixed docstring and return statement indentation

All code now follows PEP 8 style guidelines.
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

⚠️ Deployment failed for disease_control_env

  • Space repo:
  • Live URL:

Please resolve your environment.

You can iterate locally or validate fixes by running scripts/deploy_to_hf.sh --env "disease_control_env".

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

⚠️ Deployment failed for wildfire_env

  • Space repo:
  • Live URL:

Please resolve your environment.

You can iterate locally or validate fixes by running scripts/deploy_to_hf.sh --env "wildfire_env".

claude and others added 2 commits November 2, 2025 02:08
This script is required by the pr-new-env.yml workflow to deploy
new environments to Hugging Face Spaces during PR validation.

The script:
- Accepts --env, --space-suffix, and --hub-tag parameters
- Prepares files using prepare_hf_deployment.sh
- Clones or creates HF Space repository
- Deploys the environment to Hugging Face
- Provides detailed logging and error handling

Fixes CI/CD workflow error: chmod: cannot access 'scripts/deploy_to_hf.sh'
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

⚠️ Deployment failed for wildfire_env

  • Space repo:
  • Live URL:

Please resolve your environment.

You can iterate locally or validate fixes by running scripts/deploy_to_hf.sh --env "wildfire_env".

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

⚠️ Deployment failed for disease_control_env

  • Space repo:
  • Live URL:

Please resolve your environment.

You can iterate locally or validate fixes by running scripts/deploy_to_hf.sh --env "disease_control_env".

@shankerram3 shankerram3 closed this Nov 2, 2025
shankerram3 pushed a commit to shankerram3/OpenEnv that referenced this pull request Nov 2, 2025
- Remove .ipynb_checkpoints directory from version control
- Add .ipynb_checkpoints/ to .gitignore to prevent future commits

This addresses the code quality feedback from PR meta-pytorch#108 review.
Most other issues mentioned in the review (environment variable
naming, port references, burn_timers in dataclass, spelling errors,
unused imports) were already addressed in previous commits on this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants