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: Log uncaught exceptions to agent log

Kilian Lieret64a90cecc72e
diff --git a/sweagent/run/run_batch.py b/sweagent/run/run_batch.py
index 9d3188fa..5f70fe1a 100644
--- a/sweagent/run/run_batch.py
+++ b/sweagent/run/run_batch.py
@@ -251,6 +251,11 @@ class RunBatch:
env=env,
output_dir=Path(self.output_dir),
)
+ except Exception:
+ # The actual handling is happening in `run_instance`, but we need to make sure that
+ # we log it to the agent specific logger as well
+ agent.logger.error(traceback.format_exc())
+ raise
finally:
env.close()
save_predictions(self.output_dir, instance.problem_statement.id, result)