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]
Fix: Ensure proper quoting of env vars
Kilian Lieretc2b6ca93ba5b
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex 4b86f4f5..4cc0866e 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -231,6 +231,6 @@ class SWEEnv:def set_env_variables(self, env_variables: dict[str, str]) -> None:"""Set environment variables in the environment."""- _env_setters = [f"export {k}={v}" for k, v in env_variables.items()]+ _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")