fix(harness): resolve workspace-rooted absolute paths in ProjectAwareOverlay - #2515
Open
chcodex wants to merge 3 commits into
Open
fix(harness): resolve workspace-rooted absolute paths in ProjectAwareOverlay#2515chcodex wants to merge 3 commits into
chcodex wants to merge 3 commits into
Conversation
ProjectAwareOverlay.isWorkspacePath() classified any absolute path under the workspace root as workspace metadata, so an agent writing to /workspace/src/Foo.java had the write land in the workspace instead of the project directory even with projectWritable(true). Relative parts were never inspected for absolute paths. Relativize workspace-rooted absolute paths and classify them with the same WORKSPACE_PREFIXES logic used for relative paths. Non-metadata paths are rewritten to their workspace-relative form before being handed to the project filesystem, so write/edit/delete/upload land at the matching project location instead of being re-resolved against the workspace root.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Contributor
Author
|
The failing test Verified:
Re-running CI to confirm. |
…eamEventsTest failure
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…earches ProjectAwareOverlay relativized workspace-rooted absolute paths only for writes; read/exists/downloadFiles/ls/grep/glob/move passed the raw path to the overlay, where the lower project filesystem (SANDBOXED) re-rooted it under the project root and missed the file. Apply toWorkspaceRelativePath to the remaining operations so absolute paths under the workspace resolve against the matching project or workspace location consistently.
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.
Fixes #2514
Problem
With
projectWritable(true),ProjectAwareOverlaymisroutes paths when the agent uses an absolute path under the workspace root (e.g./your/workspace/src/Foo.java).isWorkspacePath()classified any workspace-rooted absolute path as workspace metadata purely by prefix, and read/search operations passed absolute paths straight to the overlay where the lower project filesystem (SANDBOXED) re-rooted them under the project root — so reads could not fall back toproject/src/Foo.java.Changes
ProjectAwareOverlay.javaisWorkspacePath()now relativizes workspace-rooted absolute paths and classifies the relative part with the sameWORKSPACE_PREFIXESlogic used for relative paths.toWorkspaceRelativePath()(renamed fromtoProjectTargetPath()), which rewrites a workspace-rooted absolute path to its workspace-relative form so the lowerSANDBOXEDproject filesystem resolves it against the project root instead of re-rooting it. Without this,ROOTEDmode would re-resolve the absolute path back into the workspace because the workspace is listed in the project FSPathPolicy.write,edit,delete,uploadFilesuse the rewritten target for the project branch.read,exists,downloadFiles,ls,grep,glob,movenow relativize workspace-rooted absolute paths before delegating to overlay semantics (upper workspace first, lower project fallback).ProjectAwareOverlayTest.javaisWorkspacePath_absoluteUnderWorkspace_returnsTrue(used a non-metadata file, which is no longer a workspace path).Verification
mvn -pl agentscope-harness -am test -Dtest=ProjectAwareOverlayTest— 26 tests, 0 failures.mvn -pl agentscope-harness test— 709 tests, 0 failures.