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]

Close environment when raising exception

Kilian Lieretd4beff2b64c2
diff --git a/run.py b/run.py
index dc13cb0d..d88218fc 100644
--- a/run.py
+++ b/run.py
@@ -375,6 +375,7 @@ class Main:
except Exception as e:
traceback.print_exc()
if self.args.raise_exceptions:
+ self.env.close()
raise e
if self.env.record:
logger.warning(f"❌ Failed on {self.env.record['instance_id']}: {e}")