fix(filesystem): reject Windows cross-drive containment - #2091
Conversation
|
Hi team, any update on this fix? This bug is blocking normal git operations for Windows users with cross-drive configurations (common setup: system on C:, projects on D:). More importantly, it conflicts with the compose-next feature highlight — /compose-next needs to create worktrees for parallel task isolation, but isolated-git-guard incorrectly blocks git worktree add due to the AppFileSystem.contains cross-drive false positive. The deadlock: compose-next wants worktrees → guard blocks worktree creation → guard says 'ask the orchestrator' → orchestrator is opt-in and also needs git ops → circular block. Would be great to have this merged soon. Thanks! |
|
cc @yanyihan-xiaomi @qiaozongming @wqymi — could you take a look at this PR? The cross-drive bug is affecting Windows users and blocking compose-next worktree creation. Thanks! |
Summary
Fixes #2067.
Windows
path.relative()returns an absolute path when the two inputs are on different drives. The sharedAppFileSystem.contains()andoverlaps()helpers only checked whether the relative path started with.., so a cross-drive absolute result could be mistaken for containment. That made ordinary Windows project directories onD:look like app-managed isolated worktrees under the MiMo data directory onC:, which then causedisolated-git-guardto block normal git operations.This PR treats absolute relative results, including Windows drive and UNC forms, as outside the parent. It also applies the same guard to the duplicate opencode filesystem helper.
Validation
bun test test/filesystem/windows-path.test.ts --timeout 30000frompackages/sharedbun test test/filesystem/filesystem.test.ts --timeout 30000frompackages/sharedbun test --timeout 30000frompackages/sharedbun test test/file/path-traversal.test.ts --timeout 30000frompackages/opencodebun test test/tool/isolated-git-guard.test.ts --timeout 30000frompackages/opencodebun typecheckfrompackages/sharedbun typecheckfrompackages/opencodegit diff --checkNote: the root pre-push hook runs
bun turbo typecheckand fails in this local checkout because@typescript/native-preview-darwin-x64is missing. I pushed with--no-verifyafter the package-level checks above passed.