Add --add-dir / for edit tool in copilot engine (workaround for GitHub/copilot-cli#67)#1805
Merged
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add workaround for edit tool enabling write permissions
Add --add-dir / for edit tool in copilot engine (workaround for GitHub/copilot-cli#67)
Oct 16, 2025
pelikhan
approved these changes
Oct 16, 2025
Contributor
|
Agentic Changeset Generator triggered by this pull request |
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.
Problem
When using the edit tool with the copilot engine, write operations fail for files outside the
/tmp/gh-aw/directory due to a limitation in copilot-cli. The copilot-cli restricts write operations to directories explicitly specified via--add-dirarguments.This is a known issue tracked in github/copilot-cli#67.
Solution
This PR adds
--add-dir /to the copilot CLI arguments when the edit tool is enabled, allowing write access to all paths in the filesystem.Implementation
The change is made in
copilot_engine.goin theGetExecutionStepsmethod:The edit tool can be present in a workflow through:
tools: { edit: }in the workflow frontmattercreate-pull-requestis configured in safe-outputs, the compiler automatically adds the edit toolGenerated Command Example
Before (edit tool fails for files outside /tmp/gh-aw/):
copilot --add-dir /tmp/gh-aw/ --log-level all --allow-tool write --prompt "..."After (edit tool works for all paths):
copilot --add-dir /tmp/gh-aw/ --log-level all --allow-tool write --add-dir / --prompt "..."Testing
Test Cases
--add-dir /is added--add-dir /is added--add-dir /is NOT added--add-dir /is NOT addedAffected Workflows
The following workflows in this repository now include the
--add-dir /workaround (they use the edit tool either explicitly or viacreate-pull-request):References
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.