Skip to content

How to restrict the CopilotClient to not read files #242

@zhiyuanliang-ms

Description

@zhiyuanliang-ms

I find that the copilot will always read all files in the workspace. I don't want to access my file.

If I deny the "grep" or "read" tool using CliArgs:

I will get the following error when starting a sessionL

Unhandled exception. System.IO.IOException: Communication error with Copilot CLI: The JSON-RPC connection with the remote party was lost before the request could complete.
 ---> StreamJsonRpc.ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete.
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync(JsonRpcRequest request, Type expectedResultType, CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at GitHub.Copilot.SDK.CopilotClient.InvokeRpcAsync[T](JsonRpc rpc, String method, Object[] args, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at GitHub.Copilot.SDK.CopilotClient.InvokeRpcAsync[T](JsonRpc rpc, String method, Object[] args, CancellationToken cancellationToken)
   at GitHub.Copilot.SDK.CopilotClient.VerifyProtocolVersionAsync(Connection connection, CancellationToken cancellationToken)
   at GitHub.Copilot.SDK.CopilotClient.<StartAsync>g__StartCoreAsync|9_0(CancellationToken ct)
   at GitHub.Copilot.SDK.CopilotClient.CleanupConnectionAsync(List`1 errors)
   at GitHub.Copilot.SDK.CopilotClient.ForceStopAsync()
   at GitHub.Copilot.SDK.CopilotClient.DisposeAsync()
   at Program.<Main>$(String[] args) in C:\Users\zhiyuanliang\Desktop\AI\CopilotDemo\Program.cs:line 89
   at Program.<Main>(String[] args)
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions