CopilotForXcode icon indicating copy to clipboard operation
CopilotForXcode copied to clipboard

When I sign in it keeps prompting me to ‘timeout’

Open roMummy opened this issue 2 years ago • 8 comments

v0.8.6 service is open.

➜ Applications launchctl list | grep com.intii 13395 0 com.intii.CopilotForXcode.ExtensionService

Permissions are supported. 20230325111739 20230325111831

20230325111844

I've tried it dozens of times.

roMummy avatar Mar 25 '23 03:03 roMummy

This means that the issue is related to a timeout during the sign-in process handled by Copilot.vim. To resolve it, all I can recommend is to ensure that you are able to connect to the GitHub Copilot server. You can also try connecting with a VPN or something if possible.

intitni avatar Mar 25 '23 03:03 intitni

I use clashx to proxy my network, how do I verify that I am connected to the GitHub Copilot server

roMummy avatar Mar 25 '23 06:03 roMummy

When I click sign in, Node will send a request to GitHub.com Screenshot 2023-03-25 at 15 13 50

intitni avatar Mar 25 '23 07:03 intitni

I use proxyman to monitor the network connection of mac, and I found that there is no network request during the period from when I press 'sign in' to 'timeout' 20230325160229

roMummy avatar Mar 25 '23 08:03 roMummy

My node version is

➜ ~ node -v v19.8.1

roMummy avatar Mar 25 '23 08:03 roMummy

It appears that the Copilot version is available, which suggests that the language server is properly started and the application can communicate with it. Therefore, the issue may be occurring internally within the language server. I have no idea how to make it work for you.

intitni avatar Mar 25 '23 08:03 intitni

Thank you for your patience

roMummy avatar Mar 25 '23 10:03 roMummy

One last thing I can suggest is to check Console.app and look for errors from subsystem: com.chimehq.JSONRPC

The language server may send logs when errors occur.

Screenshot 2023-03-25 at 19 19 02

intitni avatar Mar 25 '23 11:03 intitni

On my computer this code does not execute

    func listener(
        _: NSXPCListener,
        shouldAcceptNewConnection newConnection: NSXPCConnection
    ) -> Bool {
        newConnection.exportedInterface = NSXPCInterface(
            with: XPCServiceProtocol.self
        )

        let exportedObject = XPCService()
        newConnection.exportedObject = exportedObject
        newConnection.resume()
        return true
    }

I ran Copilot for Xcode and ExtensionService in debug mode, and I found that XPC did not monitor any connections. I can successfully monitor connections on another computer with the same code.

roMummy avatar Mar 29 '23 10:03 roMummy

I don't think this is the cause. From your screenshot above, the app has already got the XPCService version, which means the listener is already setup and they can talk to each other.

intitni avatar Mar 29 '23 11:03 intitni

If this code looks suspicious to you, you can try adding break points to the XPCService.swift in both the Client and Service target.

intitni avatar Mar 29 '23 12:03 intitni

This code is fine, I mean the client cannot connect to the server. I set a breakpoint in XPCService.swift under the client, and it will be executed when NSXPCConnection is obtained. But any breakpoints I hit on XPCService.swift under the server` will not be executed.

I found that I have two services:

➜  Downloads launchctl list | grep com.intii
-	0	com.intii.CopilotForXcode.ExtensionService
2687	0	application.dev.com.intii.CopilotForXcode.ExtensionService.142380527.142722262.EEF8D2C7-ADB8-46E1-A8FE-6DE8EBDBF34A
2745	0	dev.com.intii.CopilotForXcode.ExtensionService
2682	0	application.dev.com.intii.CopilotForXcode.142380709.142722751.E54DF447-1010-4DB9-95AE-1C014669FE08

Is it possible that xpc is not connected to the correct server

roMummy avatar Mar 30 '23 03:03 roMummy

If you are debugging the ExtensionService in Xcode, you have to remove and unload the launch agent. Otherwise the app will launch another ExtensionService and talk to that one instead.

And every time you open the host app in release mode, it will create the launch agents again, be sure to avoid that.

intitni avatar Mar 30 '23 03:03 intitni

i see the real error

{"jsonrpc":"2.0","id":7,"error":{"code":-32603,"message":"Request signInInitiate failed with message: connect ETIMEDOUT 52.69.186.44:443"}}

I don't know why my proxy is not working

roMummy avatar Mar 30 '23 07:03 roMummy

I finally succeeded, for me my hosts file was modified before.

➜  ~ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
199.232.69.194   github.global.ssl.fastly.net
#185.199.108.153  assets-cdn.github.com
#185.199.109.153  assets-cdn.github.com
#185.199.110.153  assets-cdn.github.com
#185.199.111.153  assets-cdn.github.com
#52.74.223.119  https://github.com/AudioKit/AudioKit.git
#52.69.186.44 https://github.com
#52.69.186.44 github.com

When I comment out the options related to github, it is normal. Thank you so much for your patience and guidance!

roMummy avatar Mar 30 '23 10:03 roMummy

Congratulations!

intitni avatar Mar 30 '23 10:03 intitni

If the problem comes up again, try it #copilot config 140.82.112.5 api.github.com

451222664 avatar Apr 13 '23 12:04 451222664