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: Reviewer to exit after accepting if min_draws=0 or 1

Kilian Lieretf4bc72b5e430
diff --git a/sweagent/agent/reviewer.py b/sweagent/agent/reviewer.py
index 8b383b63..f2a854ce 100644
--- a/sweagent/agent/reviewer.py
+++ b/sweagent/agent/reviewer.py
@@ -164,6 +164,11 @@ class ReviewLoopConfig(FrozenSerializable):
min_draws: int = 1
max_accepted_draws: int = 0
+ def validate(self):
+ if self.max_accepted_draws > self.min_draws:
+ msg = "`max_accepted_draws` must be less than or equal to `min_draws`, else it has no effect"
+ raise ValueError(msg)
+
# --- IMPLEMENTATIONS ---
@@ -422,7 +427,7 @@ class ReviewLoop(AbstractReviewLoop):
logger.info(f"{self.LOG_PREFIX}Exiting retry loop ({stat_str}): `max_samples` reached")
return False
- if self._reviews[-1].accept and self._n_samples >= self._loop_config.min_draws > 0:
+ if self._reviews[-1].accept and self._n_samples >= self._loop_config.min_draws:
logger.info(
f"{self.LOG_PREFIX}Existing retry loop ({stat_str}): `min_draws` reached and last submission was accepted"
)