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]

Longer timeouts for tools & repo reset

Kilian Lieret0816044ed64e
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py
index 94b10411..dab66de0 100644
--- a/sweagent/environment/swe_env.py
+++ b/sweagent/environment/swe_env.py
@@ -122,6 +122,8 @@ class SWEEnv:
input=" && ".join(startup_commands),
check=True,
error_msg="Failed to clean repository",
+ # Sometimes this is slow because it rebuilds some index
+ timeout=120,
)
def close(self) -> None:
diff --git a/sweagent/tools/tools.py b/sweagent/tools/tools.py
index 8505d4d4..4fe5788b 100644
--- a/sweagent/tools/tools.py
+++ b/sweagent/tools/tools.py
@@ -166,7 +166,7 @@ class ToolHandler:
def reset(self, env: SWEEnv) -> None:
self.logger.info("Resetting tools")
self._set_env_variables(env)
- env.communicate(" && ".join(self._reset_commands), check=True)
+ env.communicate(" && ".join(self._reset_commands), check=True, timeout=self.config.install_timeout)
def _install_commands(self, env: SWEEnv) -> None:
"""Make sure all commands are available in the container"""
@@ -189,7 +189,9 @@ class ToolHandler:
)
) # check false because bin might not exist
if (bundle / "install.sh").exists():
- env.communicate(f"cd /root/tools/{bundle.name}; bash install.sh", check=True)
+ env.communicate(
+ f"cd /root/tools/{bundle.name}; bash install.sh", check=True, timeout=self.config.install_timeout
+ )
# always make all files in bin executable
asyncio.run(
env.deployment.runtime.execute(