Repository navigation
Skip content exclusion checks for apply_patch Add File - #337324
Logan Ramos (lramos15) merged 4 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The critical exclusion bypass for existing files must be fixed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates apply_patch to permit new-file additions under content-based exclusion rules while retaining URI restrictions.
Changes:
- Skips exclusion checks for non-move
ADDactions. - Adds focused regression tests.
| File | Review |
|---|---|
extensions/copilot/src/extension/tools/test/node/applyPatch/applyPatch.spec.tsx |
Adds coverage for additions, URI restrictions, updates, and moves. |
extensions/copilot/src/extension/tools/node/applyPatchTool.tsx |
Critical: ADD can target an existing excluded file and bypass exclusion checks; verify nonexistence or reject the operation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Match create_file: model-created files skip content exclusion checks. | ||
| if (!movePath && changes.type === ActionType.ADD) { | ||
| continue; | ||
| } | ||
| await this.instantiationService.invokeFunction(accessor => assertFileNotContentExcluded(accessor, uri, undefined, contents)); |
There was a problem hiding this comment.
Fixed in 94e948a. Add File now checks the target with IFileSystemService.stat() and rejects an existing file before skipping content exclusion. I also added a regression test with the existing target registered in the mock filesystem. The focused suite passes all 13 tests.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
The remaining Linux / Electron-Smoke failure is an infrastructure timeout: the smoke-test step reached the workflow 20-minute limit without an assertion or code error. All compile, Copilot, unit, browser, remote, macOS, and Windows checks passed. I cannot rerun the job from a fork because GitHub requires repository admin rights. Please rerun the failed job when convenient. |

Summary
apply_patchcan reject*** Add Fileoperations when a repository has Copilot exclusions configured because the target does not exist yet.This change makes
apply_patchAdd File behavior consistent withcreate_file:allowedEditUrisfor every target.Testing
npm run typechecknpm run test:unit -- src/extension/tools/test/node/applyPatch/applyPatch.spec.tsxAdded focused unit tests that verify:
IIgnoreService.isCopilotIgnored.allowedEditUrisremains rejected before edits.Fixes #337528