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: max n consecutive timeout
Kilian Lieret39e8ae333bfa
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex b52677cf..f86fcc00 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -919,15 +919,15 @@ class DefaultAgent(AbstractAgent):check="raise" if self._always_require_zero_exit_code else "ignore",)except CommandTimeoutError:+ self._n_consecutive_timeouts += 1+ if self._n_consecutive_timeouts >= self.tools.config.max_consecutive_execution_timeouts:+ msg = "Exiting agent due to too many consecutive execution timeouts"+ self.logger.critical(msg)+ step.execution_time = time.perf_counter() - execution_t0+ self._total_execution_time += step.execution_time+ raisetry:- if self._n_consecutive_timeouts >= self.tools.config.max_consecutive_execution_timeouts:- msg = "Exiting agent due to too many consecutive execution timeouts"- self.logger.critical(msg)- step.execution_time = time.perf_counter() - execution_t0- self._total_execution_time += step.execution_time- raiseself._env.interrupt_session()- self._n_consecutive_timeouts += 1except Exception as f:self.logger.exception("Failed to interrupt session after command timeout: %s", f, exc_info=True)step.execution_time = time.perf_counter() - execution_t0