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]

Revert "Change: Quit after a total of > 3 timeouts"

Kilian Liereteb4d5d34ad0f
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index 597dbfd0..69ecc34f 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -404,7 +404,7 @@ class DefaultAgent(AbstractAgent):
#: Count how many timeout errors have occurred consecutively. Kills agent
#: after 5 of them.
- self._n_timeouts = 0
+ self._n_consecutive_timeouts = 0
@classmethod
def from_config(cls, config: DefaultAgentConfig) -> Self:
@@ -861,12 +861,12 @@ class DefaultAgent(AbstractAgent):
)
except CommandTimeoutError:
try:
- if self._n_timeouts >= 3:
- msg = "Exiting agent due to too many timeouts"
+ if self._n_consecutive_timeouts >= 5:
+ msg = "Exiting agent due to too many consecutive timeouts"
self.logger.critical(msg)
raise
self._env.interrupt_session()
- self._n_timeouts += 1
+ self._n_consecutive_timeouts += 1
except Exception as f:
self.logger.exception("Failed to interrupt session after command timeout: %s", f, exc_info=True)
raise
@@ -875,6 +875,8 @@ class DefaultAgent(AbstractAgent):
timeout=self.tools.config.execution_timeout,
command=run_action,
)
+ else:
+ self._n_consecutive_timeouts = 0
step.execution_time = time.perf_counter() - execution_t0
self._chook.on_action_executed(step=step)
step.state = self.tools.get_state(env=self._env)