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]

when killing process, there might be strange behaviour of not getting exit code

Talor Abramovichd09fd243d8b1
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py
index 7e5db245..9a4193aa 100644
--- a/sweagent/environment/swe_env.py
+++ b/sweagent/environment/swe_env.py
@@ -919,8 +919,11 @@ class SWEEnv(gym.Env):
self.logger.warning("Couldn't get real exit code. Setting it to 999")
exit_code = 999
elif not exit_code.isdigit():
+ # this sometimes happens if the command is being killed, for example radare2
+ # we set the error to 998 in that case
msg = f"Failed to get exit code. Output:\n---\n{buffer}\n---"
- raise RuntimeError(msg)
+ self.logger.warning("Couldn't get real exit code. Setting it to 998")
+ exit_code = 998
self.returncode = int(exit_code)
return buffer