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]
Critical fix: Copying of deployment causes image_name to mismatch
Kilian Lieret4aa5c6462377
diff --git a/sweagent/environment/config/problem_statement.py b/sweagent/environment/config/problem_statement.pyindex f918bdf0..75f9d40d 100644--- a/sweagent/environment/config/problem_statement.py+++ b/sweagent/environment/config/problem_statement.py@@ -52,6 +52,9 @@ class TextProblemStatement(BaseModel):def __repr__(self) -> str:return f"TextProblemStatement(id={self.id}, text={self.text[:30]}...)"+ def __str__(self) -> str:+ return f"id={self.id}, text={self.text[:30]}..."+class FileProblemStatement(BaseModel):path: Pathdiff --git a/sweagent/run/batch_instances.py b/sweagent/run/batch_instances.pyindex 9464e521..d1dcc65e 100644--- a/sweagent/run/batch_instances.py+++ b/sweagent/run/batch_instances.py@@ -102,6 +102,8 @@ class SimpleBatchInstance(BaseModel):"""Merge the deployment options into the `SimpleBatchInstance` object to get a full `BatchInstance`."""# Combine image name and deployment options into a DeploymentConfig object. Because this can be one of many# subclasses, we use a TypeAdapter to validate/instantiate the object.+ # Very important: Make a copy of the deployment config because it will be shared among instances!!!+ deployment = deployment.model_copy()problem_statement = TextProblemStatement(text=self.problem_statement, id=self.id)repo = PreExistingRepo(repo_name=self.repo_name, base_commit=self.base_commit)if deployment.type == "local":@@ -236,8 +238,9 @@ class SWEBenchInstances(BaseModel, AbstractInstanceSource):from datasets import load_datasetds: list[dict[str, Any]] = load_dataset(self._get_huggingface_name(), split=self.split) # type: ignore- simple_instances = [SimpleBatchInstance.from_swe_bench(instance) for instance in ds]- instances = [instance.to_full_batch_instance(self.deployment) for instance in simple_instances]+ instances = [+ SimpleBatchInstance.from_swe_bench(instance).to_full_batch_instance(self.deployment) for instance in ds+ ]return _filter_batch_items(instances, filter=self.filter, slice=self.slice)@property