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: Do not show success message in run_batch
Kilian Lieret09617b127b13
diff --git a/sweagent/run/hooks/apply_patch.py b/sweagent/run/hooks/apply_patch.pyindex e89f6950..dde265a0 100644--- a/sweagent/run/hooks/apply_patch.py+++ b/sweagent/run/hooks/apply_patch.py@@ -17,9 +17,10 @@ from sweagent.utils.log import get_loggerclass SaveApplyPatchHook(RunHook):"""This hook saves patches to a separate directory and optionally applies them to a local repository."""- def __init__(self, apply_patch_locally: bool = False):+ def __init__(self, apply_patch_locally: bool = False, show_success_message: bool = True):self.logger = get_logger("swea-save_apply_patch", emoji="⚡️")self._apply_patch_locally = apply_patch_locally+ self._show_success_message = show_success_messagedef on_init(self, *, run):self._output_dir = Path(run.output_dir)@@ -85,7 +86,8 @@ class SaveApplyPatchHook(RunHook):if _is_promising_patch(info):# Only print big congratulations if we actually believe# the patch will solve the issue- self._print_patch_message(patch_output_file)+ if self._show_success_message:+ self._print_patch_message(patch_output_file)return patch_output_filedef _apply_patch(self, patch_file: Path, local_dir: Path) -> None:diff --git a/sweagent/run/run_batch.py b/sweagent/run/run_batch.pyindex 51bc3f3b..ac67bcb1 100644--- a/sweagent/run/run_batch.py+++ b/sweagent/run/run_batch.py@@ -153,7 +153,7 @@ class RunBatch:self._chooks = CombinedRunHooks()self._redo_existing = redo_existingself._num_workers = min(num_workers, len(instances))- for hook in hooks or [SaveApplyPatchHook()]:+ for hook in hooks or [SaveApplyPatchHook(show_success_message=False)]:self.add_hook(hook)self._progress_manager = RunBatchProgressManager(num_instances=len(instances), yaml_report_path=output_dir / "run_batch_exit_statuses.yaml"