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]

Fix: Detecting edit actions

Kilian Lieretddee87635a47
diff --git a/sweagent/agent/action_sampler.py b/sweagent/agent/action_sampler.py
index 1ac6168b..a32420ad 100644
--- a/sweagent/agent/action_sampler.py
+++ b/sweagent/agent/action_sampler.py
@@ -230,7 +230,7 @@ class BinaryTrajectoryComparison(AbstractActionSampler):
keywords = ["edit", "str_replace_editor insert", "str_replace_editor str_replace"]
for completion in completions:
_, action = self._tools.parse_actions(completion)
- if any(keyword in action for keyword in keywords):
+ if any(action.startswith(keyword) for keyword in keywords):
return True
return False
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index c4d510a6..c06595c7 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -326,6 +326,7 @@ class Agent:
# This ensures that the file handler is added to the model's logger
self.model.logger.name = f"swea-lm-{iid}"
except AttributeError:
+ self.logger.warning("Model does not have a logger, cannot set name")
pass
# Save/reset some attributes