copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Authorization always hangs and then you can't quit copilot (might be related to not being able to launch browser in SSH session)

Open benstaniford opened this issue 1 year ago โ€ข 28 comments

Describe the bug

When I attempt to authorize, I'm doing so on a linux arm64 machine that I'm ssh'd into. I get the device code and go to the URL specified on my main browser and then I I hit enter to say I've copied the device code manually. I then authorize on the website successfully, and then copilot hangs with this screen:

Image

I've tried varying the order of authenticating and hitting enter and I've tried authenticating a total of 6 times now over several days. I have no problems with my internet connection and the machine I'm logged into has no problem talking to copilot more generally (I'm using the VS code copilot on there).

Additionally, when I try to ctrl-c out of the "Waiting for authorization", that also hangs giving me this:

Image

Affected version

0.0.328

Steps to reproduce the behavior

When I attempt to authorize, I'm doing so on a linux arm64 machine that I'm ssh'd into. I get the device code and go to the URL specified on my main browser and then I I hit enter to say I've copied the device code manually. I then authorize on the website successfully, and then copilot hangs with this screen:

Image

I've tried varying the order of authenticating and hitting enter and I've tried authenticating a total of 6 times now over several days. I have no problems with my internet connection and the machine I'm logged into has no problem talking to copilot more generally (I'm using the VS code copilot on there).

Additionally, when I try to ctrl-c out of the "Waiting for authorization", that also hangs giving me this:

Image

Expected behavior

I should be able to authenticate

Additional context

OS: Debian Trixie Linux on ARM64 Raspberry Pi 5

benstaniford avatar Sep 27 '25 13:09 benstaniford

I have the same error in the latest stabel release.

im also sshd into a raspi...

I can shutdown if i havent done /login yet but after being in the loop it doesnt

joan-code6 avatar Oct 01 '25 14:10 joan-code6

Same here, im using ubuntu server 24.

Image

visual-alchemy avatar Oct 02 '25 16:10 visual-alchemy

Did you guys try the authentication adding the env as documentation says?

Image

Even tho that authentication process isn't working, I solved it that way.

despinozap avatar Oct 02 '25 20:10 despinozap

@despinozap Thanks, that's a good workaround! For some reason that particular permission is only available in the "public repositories" scope, so I've had to create a second PAT token specifically for copilot. However, it works.

The following alias helps use it without trampling my regular github PAT.

alias copilot='GH_TOKEN=$COPILOT_PAT /usr/local/bin/copilot'

benstaniford avatar Oct 03 '25 05:10 benstaniford

@benstaniford Cool! I also created a new token for that. I'd like to be using that auth process but that's still broken in the callback flow or something like that I guess. Well.. at least we can start playing around with the cli meanwhile it's fixed ๐Ÿ™Œ

despinozap avatar Oct 03 '25 10:10 despinozap

@benstaniford the workaround doesnt work on my machine... maybe im just to dumb:

(venv) bennet@raspberrypi:~ $ alias copilot='GH_TOKEN=ghp_(my github pat) /usr/local/bin/copilot' (venv) bennet@raspberrypi:~ $ copilot Welcome to GitHub Copilot CLI Version 0.0.331 ยท Commit eb0ae04

Copilot can write, test and debug code right from your terminal. Describe a task to get started or enter ? for help. Copilot uses AI, check for mistakes.

Please use /login to sign in to use Copilot ~ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Enter @ to mention files or / for commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Ctrl+c Exit ยท Ctrl+r Expand Recent

Thank you for youre help!

joan-code6 avatar Oct 05 '25 17:10 joan-code6

@joan-code6 That looks ok.. Does your PAT token have the correct "Copilot Requests" permission?

benstaniford avatar Oct 06 '25 08:10 benstaniford

We should have a page that looks like this when we can't get your clipboard/can't launch your browser:

Image

today I'll look into why this might not be firing correctly on SSH sessions -- ~~I wonder if it's relevant that you're both on Raspberry Pi, too~~ nevermind, saw the Ubuntu Server report as well

RyanHecht avatar Oct 06 '25 15:10 RyanHecht

Question: are you folks all SSH'd using VSCode remote? And can you still reproduce this bug if you SSH outside of VSCode?

RyanHecht avatar Oct 06 '25 16:10 RyanHecht

@RyanHecht Thanks for looking into it!

are you folks all SSH'd using VSCode remote? And can you still reproduce this bug if you SSH outside of VSCode?

No, I'm using plain old Windows Terminal and the SSH version that comes with Git for Windows.

benstaniford avatar Oct 06 '25 16:10 benstaniford

@RyanHecht I've just tried PuTTY as well, and I can reproduce the same issue with that.

benstaniford avatar Oct 06 '25 16:10 benstaniford

Thanks for trying that for me @benstaniford! One more thing to try: If you manually go to https://github.com/login/device and enter your code, does it continue to hang, or does it eventually complete after ~30 seconds?

(Sorry to keep sending you on fetch quests, but I haven't been able to reproduce this via SSH-ing into any of my machines thus far!)

RyanHecht avatar Oct 06 '25 16:10 RyanHecht

@RyanHecht It hangs indefinitely, here's me waiting for about a minute:

EDIT: Ah, looks like I can't upload video, anyway it does.

benstaniford avatar Oct 06 '25 16:10 benstaniford

Thank you! Going to work on an improved experience for this edge case in the absence of knowing the root cause

RyanHecht avatar Oct 06 '25 18:10 RyanHecht

@RyanHecht Do you want me to dump the process or anything? That's probably what I'd do in this situation, but I'm not a node guy so I'm unsure if it helps you.

benstaniford avatar Oct 06 '25 20:10 benstaniford

@RyanHecht I collected a dump of node process when it had been stuck like this for about a minute:

Image

https://www.dropbox.com/scl/fi/xlfzcapsj536fdxa70oqx/node_dump.zip?rlkey=cgi441g01dc8zuohhdbb7pp43&dl=0

I understand you could look at the stack traces in llnode (https://github.com/nodejs/llnode)

benstaniford avatar Oct 06 '25 20:10 benstaniford

This is fixed in 0.0.335!

RyanHecht avatar Oct 06 '25 21:10 RyanHecht

Hi @RyanHecht ,

I just gave 0.0.335 a try and unfortunately the behavior is pretty much the same as before. (Although it may be flickering more on reauth?)

Image

benstaniford avatar Oct 07 '25 08:10 benstaniford

Oh no! And even after manually visiting the the page and entering the code, it still hangs there? @benstaniford

RyanHecht avatar Oct 07 '25 15:10 RyanHecht

@RyanHecht I'm afraid so yeh :-(

Do you want me to collect any further dumps or anything? I'm happy to get stack traces or whatever of what the program is doing during that hang.

benstaniford avatar Oct 07 '25 15:10 benstaniford