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 [email protected]. 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

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.

2 participants