Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Enh(env): If no env variables to set

Kilian Lieretdc41c315e240
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py
index 25cd7a79..9802efac 100644
--- a/sweagent/environment/swe_env.py
+++ b/sweagent/environment/swe_env.py
@@ -234,6 +234,9 @@ class SWEEnv:
def set_env_variables(self, env_variables: dict[str, str]) -> None:
"""Set environment variables in the environment."""
+ if not env_variables:
+ self.logger.debug("No environment variables to set")
+ return
_env_setters = [f"export {k}={shlex.quote(str(v))}" for k, v in env_variables.items()]
command = " && ".join(_env_setters)
self.communicate(command, check="raise")