Skip to content

fix: remove workspaces containing root-owned container files#141

Merged
eshulman2 merged 1 commit into
mainfrom
fix/workspace-cleanup-root-owned
Jul 13, 2026
Merged

fix: remove workspaces containing root-owned container files#141
eshulman2 merged 1 commit into
mainfrom
fix/workspace-cleanup-root-owned

Conversation

@eshulman2

Copy link
Copy Markdown
Collaborator

Summary

Workspace cleanup currently uses shutil.rmtree, which can fail when containers leave root-owned files behind. Use podman unshare rm -rf when Podman is available so cleanup runs in the same user namespace that owns those files.

If Podman is unavailable, exits unsuccessfully, or cannot be started, cleanup falls back to shutil.rmtree.

This change was extracted from #44 so the workspace-removal fix can be reviewed and merged independently from .forge/ artifact persistence.

Changes

  • Resolve Podman from PATH before cleanup
  • Remove the workspace through podman unshare rm -rf
  • Fall back to shutil.rmtree for unavailable or failed Podman execution
  • Preserve workspace registry and active-state cleanup behavior
  • Add focused coverage for success and each fallback path

Test plan

  • uv run ruff format --check src/
  • uv run ruff check src/
  • uv run pytest tests/unit/workspace/test_manager_cleanup.py (5 passed)

@eshulman2 eshulman2 merged commit 6ef7499 into main Jul 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant