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: Sort exit status table by frequency

Kilian Lieretbd9eef720e77
diff --git a/sweagent/run/_progress.py b/sweagent/run/_progress.py
index 93601873..90362d7e 100644
--- a/sweagent/run/_progress.py
+++ b/sweagent/run/_progress.py
@@ -88,8 +88,9 @@ class RunBatchProgressManager:
t.show_header = False
with self._lock:
t.show_header = True
- # self._exit_status_table.rows.clear()
- for status, instances in self._instances_by_exit_status.items():
+ # Sort by number of instances in descending order
+ sorted_items = sorted(self._instances_by_exit_status.items(), key=lambda x: len(x[1]), reverse=True)
+ for status, instances in sorted_items:
instances_str = _shorten_str(", ".join(reversed(instances)), 55)
t.add_row(status, str(len(instances)), instances_str)
assert self.render_group is not None