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]
Improved error handling with get_env()
Kilian Lieretfd8954885ce1
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex bebac81e..1fc1b75a 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -228,7 +228,11 @@ class SWEEnv:env_output = self.communicate("env", check=True).strip()if not env_output:return {}- return dict(line.split("=", 1) for line in env_output.split("\n"))+ try:+ return dict(line.split("=", 1) for line in env_output.splitlines() if line.strip())+ except ValueError:+ self.logger.error(f"Env output: {env_output!r}")+ raisedef set_env_variables(self, env_variables: dict[str, str]) -> None:"""Set environment variables in the environment."""