fix: add exist_ok=True to mkdir in BubblewrapEnvironment by hobostay · Pull Request #802 · SWE-agent/mini-swe-agent (original) (raw)

Summary

The mkdir call in BubblewrapEnvironment.__init__ was missing exist_ok=True, which is inconsistent with the rest of the codebase and could cause FileExistsError in rare edge cases.

Problem

In src/minisweagent/environments/extra/bubblewrap.py:79, the code calls:

self.working_dir.mkdir(parents=True)

While the directory name uses a UUID to minimize collision risk, there's a small chance that:

  1. UUID collision occurs (very rare but possible)
  2. An external process creates the same directory
  3. A previous run didn't clean up properly

In such cases, this would raise FileExistsError and fail initialization.

Solution

Add exist_ok=True to match the pattern used throughout the codebase:

self.working_dir.mkdir(parents=True, exist_ok=True)

Consistency

All other mkdir calls in the project use exist_ok=True:

Test plan

🤖 Generated with Claude Code