fix(isolation): auto-detect overlayfs and fallback for Docker compatibility#92
Conversation
Add is_overlayfs() detection using statfs with OVERLAYFS_SUPER_MAGIC. When project root is on overlayfs (Docker overlay2 storage), skip overlay mounts but keep namespace isolation, RO root remount, and tmpfs. Workers get fork-only isolation instead of crashing with EINVAL. Refs #83
Report overlay filesystem status in `tach self-test` Capabilities section. Warns if project root is on overlayfs with remediation guidance. Closes #83
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes implement auto-detection of overlayfs filesystems and graceful fallback to fork-only isolation when nested overlays are detected. New public diagnostic checks expose overlayfs detection capabilities, and the isolation setup conditionally disables overlay mounting when the project root resides on overlayfs, preventing kernel errors in Docker environments. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
is_overlayfs()detection usingstatfswithOVERLAYFS_SUPER_MAGICtach self-testCloses #83
How it works
Docker uses overlay2 storage driver → container root is already overlayfs → Linux kernel doesn't support nested overlay → tach's overlay mount fails with EINVAL.
Fix: At worker startup,
setup_filesystem()checks ifproject_rootis on overlayfs. If so, skip the overlay mount steps but keep all other isolation (mount namespace, RO root remount, tmpfs). Workers get fork-only isolation instead of crashing.Verification
[tach:isolation] Project root is on overlayfs (Docker detected). Overlay mounts disabled — using fork-only isolation.✅--no-isolationinside Docker: 4/4 pass ✅tach self-testfrom overlayfs dir:[WARN] Overlay FS: Project root is on overlayfs✅tach self-testfrom native fs:[PASS] Overlay FS: Native filesystem✅Summary by CodeRabbit
Release Notes