fix(#2312): prevent nested workspace directory in SANDBOXED mode when project is subdirectory of workspace [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH] - #2430
Open
waterWang wants to merge 1 commit into
Conversation
…XED mode when project is subdirectory of workspace [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Collaborator
|
CI Failure — Spotless formatting Build fails on Fix: run |
oss-maintainer
requested changes
Jul 28, 2026
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
Review: fix(#2312): prevent nested workspace directory in SANDBOXED mode
The logic is sound — detecting when project is a subdirectory of workspace and skipping the overlay avoids the circular dependency. The isSubdirectoryOf() helper with normalization is correct.
However, CI is failing due to a Spotless formatting violation (trailing newline) in LocalFilesystemSpec.java. Please run mvn spotless:apply and push the fix.
Code observations
isSubdirectoryOf()correctly normalizes both paths before comparison- Skipping
policyRoots.add(effectiveProject)when it's a subdirectory is correct — workspace already covers it - Returning
upperdirectly (without overlay) when project ⊆ workspace is the right call
Once formatting is fixed, this should be good to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
LocalFilesystemSpecis configured withLocalFsMode.SANDBOXEDand theprojectdirectory is a subdirectory of theworkspace(e.g.,project=agentRoot/workspace,workspace=agentRoot), theOverlayFilesystemcreates a circular dependency: the lower layer (project) is inside the upper layer (workspace).This manifests as a nested working directory being created inside the user's workspace in SANDBOXED mode, while the same configuration works correctly in local mode.
Root Cause
In
LocalFilesystemSpec.toFilesystem(), the overlay always creates two layers:LocalFilesystemWithShell(workspace, ...)LocalFilesystem(project, ...)When
projectis a subdirectory ofworkspace, the lower layer is inside the upper layer's file tree, causing the overlay to create a nested directory structure.Fix
isSubdirectoryOf()helper that checks whether one path is a subdirectory of another (both normalized).toFilesystem(), detect when the project is a subdirectory of the workspace. When this is the case:policyRoots(workspace already covers it)Testing
LocalFilesystemSpecwithmode=LocalFsMode.SANDBOXED,project=agentRoot/workspace,workspace=agentRoot— no nested directory should be createdCloses #2312