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): Make sure we don't run out of cost in reviews
Kilian Lieret809bbe436bd3
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex 03d675a9..b404fb56 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -346,7 +346,12 @@ class Agent:self._info_by_attempt = defaultdict(dict) # type: ignoreself._forwarded_vars = {}if self.retry_loop_config is not None:- self._rloop = get_retry_loop_from_config(self.retry_loop_config, problem_statement, self.model)+ # Make sure to initialize a new model, so that the reviews itself do not count+ # to the instance stats and in particular we can't run out of cost there.+ rloop_model = get_model(+ self.model.config.model_copy(update={"per_instance_cost_limit": 0}), self.tools.config+ )+ self._rloop = get_retry_loop_from_config(self.retry_loop_config, problem_statement, rloop_model)if self._rloop is not None:self._forwarded_vars = self._rloop.get_forwarded_vars()self._chook.on_tools_installation_started()diff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex 973e89d7..239d192d 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -231,8 +231,8 @@ class InstanceStats(PydanticBaseModel):class AbstractModel(ABC):- def __init__(self, config: PydanticBaseModel, tools: ToolConfig):- self.config: PydanticBaseModel+ def __init__(self, config: ModelConfig, tools: ToolConfig):+ self.config: ModelConfigself.stats: InstanceStatsdef reset_stats(self):