Describe the bug
Whenever I finish running mini-swe-agent, it consistently leaves behind a large number of exited Docker containers.
This appears to be because the commands within the cleanup method of the DockerEnvironment class use the logical OR operator (||) between docker stop and docker rm, resulting in the containers not being removed after their usage is complete.
Is this the intended behavior?
|
def cleanup(self): |
|
"""Stop and remove the Docker container.""" |
|
if getattr(self, "container_id", None) is not None: # if init fails early, container_id might not be set |
|
cmd = f"(timeout 60 {self.config.executable} stop {self.container_id} || {self.config.executable} rm -f {self.container_id}) >/dev/null 2>&1 &" |
|
subprocess.Popen(cmd, shell=True) |
Describe the bug
Whenever I finish running mini-swe-agent, it consistently leaves behind a large number of exited Docker containers.
This appears to be because the commands within the
cleanupmethod of theDockerEnvironmentclass use the logical OR operator (||) betweendocker stopanddocker rm, resulting in the containers not being removed after their usage is complete.Is this the intended behavior?
mini-swe-agent/src/minisweagent/environments/docker.py
Lines 153 to 157 in 58ad92f