Repository navigation
AHP filesystem: make resolved files writable and add realpath capability - #321191
Merged
Merged
Conversation
Resolved resources were always stamped with FilePermission.Readonly in stat(), so real files opened read-only even though the provider advertises FileReadWrite and implements writeFile. Drop the spurious flag for real resources (keeping it only for the synthetic root and the virtual session-db / git-blob schemes). Also surface the canonical-path information the AHP resourceResolve already returns by advertising the FileRealpath capability and implementing realpath(), which re-encodes the resolved canonical URI back into provider space. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes editability for real files exposed through the Agent Host filesystem provider by stopping stat() from unconditionally applying FilePermission.Readonly to resolved resources, and adds realpath support so the provider can surface canonical (symlink-resolved) paths back to the file service.
Changes:
- Remove the spurious
FilePermission.Readonlyfromstat()results for non-virtual resolved resources (keeping readonly only for synthetic root and virtualsession-db/git-blob). - Advertise
FileSystemProviderCapabilities.FileRealpathand implementrealpath()via a shared_resolve()helper. - Add unit tests covering non-readonly stats for resolved files and realpath re-encoding behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/common/agentHostFileSystemProvider.ts | Stops marking resolved resources readonly and adds realpath() + capability advertising using a shared resolve helper. |
| src/vs/platform/agentHost/test/common/agentHostFileSystemProvider.test.ts | Adds unit tests for editability (no readonly permission) and canonical-path re-encoding via realpath(). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
Michael Lively (Yoyokrazy)
approved these changes
Jun 12, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
The
AHPFileSystemProvideradvertisesFileReadWriteand implementswriteFile, but every resolved resource was stamped withFilePermission.Readonlyinstat()— so real files opened read-only and editors refused edits.Changes
FilePermission.Readonlyfrom real resources resolved viaresourceResolve. It's kept only for genuinely read-only cases (the synthetic root and the virtualsession-db/git-blobschemes).FileRealpathcapability: the AHPresourceResolvealready returns the canonical (symlink-resolved) URI, so the provider now advertisesFileSystemProviderCapabilities.FileRealpath, implementsIFileSystemProviderWithFileRealpathCapability, and exposesrealpath()which re-encodes the canonical URI back into provider space. A small_resolve()helper is shared bystatandrealpath.Notes on etags
Etag-based optimistic concurrency is intentionally not wired into the provider: the file service performs its own dirty-write prevention (mtime/size-derived etag) and never forwards an etag to
provider.writeFile, so there is no stateless token for the provider to replay.Testing
Added two unit tests (resolved files are not read-only;
realpathcanonicalization). All 30 tests in the suite pass.