zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.6k stars 2.64k forks source link

Copilot can't be started: failed to deserialize response. #6954

Closed fran122157 closed 6 months ago

fran122157 commented 7 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Can't enable copilot. Have tried:

Environment

image

If applicable, add mockups / screenshots to help explain present your vision of the feature

image

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

zed.log

fran122157 commented 7 months ago
024-02-03T01:37:27 [INFO] Opening main db
2024-02-03T01:37:28 [INFO] reload git repository ".git"
2024-02-03T01:37:29 [INFO] reload git repository ".git"
2024-02-03T01:37:29 [INFO] reload git repository ".git"
2024-02-03T01:38:16 [INFO] Node runtime install_if_needed
2024-02-03T01:38:17 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-02-03T01:38:17.484Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-02-03T01:38:17.484Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-02-03T01:38:17 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "a568d16d-49e8-4ea0-9c8c-5408760971d1",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-02-03T01:38:17 [ERROR] crates/lsp/src/lsp.rs:615: oneshot canceled
2024-02-03T01:38:25 [ERROR] crates/terminal_view/src/terminal_view.rs:402: error upgrading view
2024-02-03T01:38:31 [ERROR] crates/ai/src/providers/open_ai/completion.rs:232: NotPresent
2024-02-03T01:38:31 [ERROR] crates/ai/src/providers/open_ai/completion.rs:232: NotPresent
2024-02-03T01:38:39 [INFO] reload git repository ".git"
2024-02-03T01:38:40 [INFO] reload git repository ".git"
2024-02-03T01:38:44 [INFO] Node runtime install_if_needed
2024-02-03T01:38:44 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-02-03T01:38:44.680Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-02-03T01:38:44.680Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-02-03T01:38:44 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "801514e6-3f58-4f0c-9e80-16e9f4248248",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-02-03T01:38:45 [ERROR] crates/lsp/src/lsp.rs:615: oneshot canceled
2024-02-03T01:38:45 [ERROR] crates/copilot_ui/src/copilot_button.rs:369: copilot hasn't started yet
mrnugget commented 7 months ago

Hey @fran122157! I'm trying to understand why it fails to install copilot, so I have a couple of questions:

  1. Did it download Copilot into ~/Library/Application Support/Zed/copilot/`? Are there any files in there?
  2. Can you give me the output of curl -v --trace-time -L 'https://github.com/zed-industries/copilot/releases/download/v0.5.0/copilot.tar.gz' >/dev/null? I want to see how long it takes for you to download copilot and whether you run into any timeouts.
fran122157 commented 7 months ago
  • Did it download Copilot into ~/Library/Application Support/Zed/copilot/`? Are there any files in there?

Hi! Thanks for the response 😄

1- Yeap, I tried to remove them manually and starting Zed again after that but no luck.

image

2- Sure, here it goes:

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 013:07:28.363120 Trying 20.201.28.151:443... 13:07:28.408055 Connected to github.com (20.201.28.151) port 443 (#0) 13:07:28.410049 ALPN: offers h2,http/1.1 13:07:28.410958 (304) (OUT), TLS handshake, Client hello (1): 13:07:28.410975 } [315 bytes data] 13:07:28.415618 CAfile: /etc/ssl/cert.pem 13:07:28.415636 CApath: none 13:07:28.457277 (304) (IN), TLS handshake, Server hello (2): 13:07:28.457304 { [122 bytes data] 13:07:28.457851 (304) (IN), TLS handshake, Unknown (8): 13:07:28.457870 { [19 bytes data] 13:07:28.457921 (304) (IN), TLS handshake, Certificate (11): 13:07:28.457937 { [2459 bytes data] 13:07:28.460456 (304) (IN), TLS handshake, CERT verify (15): 13:07:28.460470 { [78 bytes data] 13:07:28.460657 (304) (IN), TLS handshake, Finished (20): 13:07:28.460670 { [36 bytes data] 13:07:28.460794 (304) (OUT), TLS handshake, Finished (20): 13:07:28.460817 } [36 bytes data] 13:07:28.460851 SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 13:07:28.460884 ALPN: server accepted h2 13:07:28.460918 Server certificate: 13:07:28.460944 subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=github.com 13:07:28.460968 start date: Feb 14 00:00:00 2023 GMT 13:07:28.460985 expire date: Mar 14 23:59:59 2024 GMT 13:07:28.461007 subjectAltName: host "github.com" matched cert's "github.com" 13:07:28.461029 issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS Hybrid ECC SHA384 2020 CA1 13:07:28.461047 SSL certificate verify ok. 13:07:28.461139 using HTTP/2 13:07:28.461180 h2 [:method: GET] 13:07:28.461199 h2 [:scheme: https] 13:07:28.461214 h2 [:authority: github.com] 13:07:28.461232 h2 [:path: /zed-industries/copilot/releases/download/v0.5.0/copilot.tar.gz] 13:07:28.461249 h2 [user-agent: curl/8.1.2] 13:07:28.461268 h2 [accept: /] 13:07:28.461288 Using Stream ID: 1 (easy handle 0x15680e200) 13:07:28.461329 > GET /zed-industries/copilot/releases/download/v0.5.0/copilot.tar.gz HTTP/2 13:07:28.461329 > Host: github.com 13:07:28.461329 > User-Agent: curl/8.1.2 13:07:28.461329 > Accept: / 13:07:28.461329 > 13:07:28.705618 < HTTP/2 302 13:07:28.705701 < server: GitHub.com 13:07:28.705733 < date: Tue, 06 Feb 2024 16:07:29 GMT 13:07:28.705764 < content-type: text/html; charset=utf-8 13:07:28.705807 < vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With 13:07:28.705847 < location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/617537369/27822839-5654-46fc-94be-8550154318a9?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240206T160729Z&X-Amz-Expires=300&X-Amz-Signature=a10df69423dbff5b1aa63c1045f1d8d184fcbeaa72083cd99d5f216078841cfc&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=617537369&response-content-disposition=attachment%3B%20filename%3Dcopilot.tar.gz&response-content-type=application%2Foctet-stream 13:07:28.705878 < cache-control: no-cache 13:07:28.705920 < strict-transport-security: max-age=31536000; includeSubdomains; preload 13:07:28.705947 < x-frame-options: deny 13:07:28.705973 < x-content-type-options: nosniff 13:07:28.706000 < x-xss-protection: 0 13:07:28.706027 < referrer-policy: no-referrer-when-downgrade 13:07:28.706057 < content-security-policy: default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events api.githubcopilot.com objects-origin.githubusercontent.com .actions.githubusercontent.com wss://.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com .githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/ 13:07:28.706735 < content-length: 0 13:07:28.706776 < x-github-request-id: C31D:11A5D2:34987F:37BE38:65C25940 13:07:28.706811 < 13:07:28.706868 { [0 bytes data] 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 13:07:28.707119 Connection #0 to host github.com left intact 13:07:28.707192 Issue another request to this URL: 'https://objects.githubusercontent.com/github-production-release-asset-2e65be/617537369/27822839-5654-46fc-94be-8550154318a9?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240206T160729Z&X-Amz-Expires=300&X-Amz-Signature=a10df69423dbff5b1aa63c1045f1d8d184fcbeaa72083cd99d5f216078841cfc&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=617537369&response-content-disposition=attachment%3B%20filename%3Dcopilot.tar.gz&response-content-type=application%2Foctet-stream' 13:07:28.725470 Trying 185.199.111.133:443... 13:07:28.739630 Connected to objects.githubusercontent.com (185.199.111.133) port 443 (#1) 13:07:28.739720 ALPN: offers h2,http/1.1 13:07:28.739993 (304) (OUT), TLS handshake, Client hello (1): 13:07:28.740012 } [334 bytes data] 13:07:28.758746 (304) (IN), TLS handshake, Server hello (2): 13:07:28.758777 { [122 bytes data] 13:07:28.758974 (304) (IN), TLS handshake, Unknown (8): 13:07:28.758991 { [19 bytes data] 13:07:28.759048 (304) (IN), TLS handshake, Certificate (11): 13:07:28.759065 { [3050 bytes data] 13:07:28.759439 (304) (IN), TLS handshake, CERT verify (15): 13:07:28.759456 { [264 bytes data] 13:07:28.759550 (304) (IN), TLS handshake, Finished (20): 13:07:28.759567 { [36 bytes data] 13:07:28.759713 (304) (OUT), TLS handshake, Finished (20): 13:07:28.759734 } [36 bytes data] 13:07:28.759768 SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 13:07:28.759786 ALPN: server accepted h2 13:07:28.759804 Server certificate: 13:07:28.759828 subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=.github.io 13:07:28.759848 start date: Feb 21 00:00:00 2023 GMT 13:07:28.759865 expire date: Mar 20 23:59:59 2024 GMT 13:07:28.759889 subjectAltName: host "objects.githubusercontent.com" matched cert's ".githubusercontent.com" 13:07:28.759910 issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS RSA SHA256 2020 CA1 13:07:28.759927 SSL certificate verify ok. 13:07:28.760002 using HTTP/2 13:07:28.760050 h2 [:method: GET] 13:07:28.760067 h2 [:scheme: https] 13:07:28.760083 h2 [:authority: objects.githubusercontent.com] 13:07:28.760101 h2 [:path: /github-production-release-asset-2e65be/617537369/27822839-5654-46fc-94be-8550154318a9?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240206T160729Z&X-Amz-Expires=300&X-Amz-Signature=a10df69423dbff5b1aa63c1045f1d8d184fcbeaa72083cd99d5f216078841cfc&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=617537369&response-content-disposition=attachment%3B%20filename%3Dcopilot.tar.gz&response-content-type=application%2Foctet-stream] 13:07:28.760119 h2 [user-agent: curl/8.1.2] 13:07:28.760134 h2 [accept: /] 13:07:28.760149 Using Stream ID: 1 (easy handle 0x15680e200) 13:07:28.760192 > GET /github-production-release-asset-2e65be/617537369/27822839-5654-46fc-94be-8550154318a9?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240206T160729Z&X-Amz-Expires=300&X-Amz-Signature=a10df69423dbff5b1aa63c1045f1d8d184fcbeaa72083cd99d5f216078841cfc&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=617537369&response-content-disposition=attachment%3B%20filename%3Dcopilot.tar.gz&response-content-type=application%2Foctet-stream HTTP/2 13:07:28.760192 > Host: objects.githubusercontent.com 13:07:28.760192 > User-Agent: curl/8.1.2 13:07:28.760192 > Accept: / 13:07:28.760192 > 13:07:29.371462 < HTTP/2 200 13:07:29.371502 < content-type: application/octet-stream 13:07:29.371518 < content-md5: iQ98PluvfMKzd23DJm2mIg== 13:07:29.371534 < last-modified: Thu, 30 Mar 2023 16:17:33 GMT 13:07:29.371552 < etag: "0x8DB313A448D25AC" 13:07:29.371570 < server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 13:07:29.371589 < x-ms-request-id: 7b5d9f0e-a01e-000c-1ab2-4c765d000000 13:07:29.371605 < x-ms-version: 2020-10-02 13:07:29.371621 < x-ms-creation-time: Thu, 30 Mar 2023 16:17:33 GMT 13:07:29.371636 < x-ms-lease-status: unlocked 13:07:29.371652 < x-ms-lease-state: available 13:07:29.371669 < x-ms-blob-type: BlockBlob 13:07:29.371685 < content-disposition: attachment; filename=copilot.tar.gz 13:07:29.371703 < x-ms-server-encrypted: true 13:07:29.371721 < via: 1.1 varnish, 1.1 varnish 13:07:29.371738 < accept-ranges: bytes 13:07:29.371756 < date: Tue, 06 Feb 2024 16:07:29 GMT 13:07:29.371775 < age: 3577 13:07:29.371792 < x-served-by: cache-iad-kiad7000087-IAD, cache-eze2230034-EZE 13:07:29.371807 < x-cache: HIT, HIT 13:07:29.371822 < x-cache-hits: 15513, 1 13:07:29.371838 < x-timer: S1707235649.317507,VS0,VE591 13:07:29.371854 < content-length: 2722841 13:07:29.371870 < 0 2659k 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 013:07:29.378261 { [16375 bytes data] 100 2659k 100 2659k 0 0 2076k 0 0:00:01 0:00:01 --:--:-- 10.3M 13:07:29.622735 Connection #1 to host objects.githubusercontent.com left intact

mrnugget commented 7 months ago

Thanks! If you use debug: open language server logs and select copilot -- are there any logs in there? Can you paste them here?

fran122157 commented 7 months ago

Mmm, nope, no copilot logs. Here they go just in case

[Global] Creating projects: [{"folder":"/Users/francisco/Documents/elevvate-fe","configPath":"/Users/francisco/Documents/elevvate-fe/tailwind.config.js","isUserConfigured":false,"documentSelector":[{"pattern":"/Users/francisco/Documents/elevvate-fe/tailwind.config.js","priority":0},{"pattern":"/Users/francisco/Documents/elevvate-fe/src/**/*.{js,ts,jsx,tsx}","priority":1},{"pattern":"/Users/francisco/Documents/elevvate-fe/node_modules/@tremor/**/*.{js,ts,jsx,tsx}","priority":1},{"pattern":"/Users/francisco/Documents/elevvate-fe/**","priority":3}]}] [Global] Adding watch patterns: /Users/francisco/Documents/elevvate-fe/tailwind.config.js, /Users/francisco/Documents/elevvate-fe [tailwind.config.js] Initializing... [tailwind.config.js] Loaded Tailwind CSS config file: /Users/francisco/Documents/elevvate-fe/tailwind.config.js [tailwind.config.js] Loaded postcss v8.4.33: /Users/francisco/Documents/elevvate-fe/node_modules/postcss [tailwind.config.js] Loaded tailwindcss v3.4.1: /Users/francisco/Documents/elevvate-fe/node_modules/tailwindcss [tailwind.config.js] Building...

fran122157 commented 7 months ago

Just leaving this here. Just updated to the latest version of zed and the problem persists

image
fran122157 commented 6 months ago

Hey there! Any update on this??

Please let me know if you need me to add any more info this issue

mrnugget commented 6 months ago

Hey @fran122157! Sorry to leave you hanging on this — the amount of issues flying our way right now is ... a lot. Sorry!

I've just opened https://github.com/zed-industries/zed/pull/8046 so we get better debugging in the future.

But for now, let's try to see what copilot says when you try to start it manually:

$ cd ~/Library/Application\ Support/Zed
$ ./node/node-v18.15.0-darwin-arm64/bin/node ./copilot/copilot-v0.5.0/dist/agent.js --stdio
Content-Length: 232

{"jsonrpc":"2.0","method":"LogMessage","params":{"level":0,"message":"[DEBUG] [agent] [2024-02-20T09:11:15.741Z] Agent service starting","metadataStr":"[DEBUG] [agent] [2024-02-20T09:11:15.741Z]","extra":["Agent service starting"]}}^C

So, question nr 1: what does that print for you?

Question nr 2: do you have by chance any package.json, package_lock.json, node_module files in your homedirectory?

fran122157 commented 6 months ago

Hey @fran122157! Sorry to leave you hanging on this — the amount of issues flying our way right now is ... a lot. Sorry!

I've just opened #8046 so we get better debugging in the future.

But for now, let's try to see what copilot says when you try to start it manually:

$ cd ~/Library/Application\ Support/Zed
$ ./node/node-v18.15.0-darwin-arm64/bin/node ./copilot/copilot-v0.5.0/dist/agent.js --stdio
Content-Length: 232

{"jsonrpc":"2.0","method":"LogMessage","params":{"level":0,"message":"[DEBUG] [agent] [2024-02-20T09:11:15.741Z] Agent service starting","metadataStr":"[DEBUG] [agent] [2024-02-20T09:11:15.741Z]","extra":["Agent service starting"]}}^C

So, question nr 1: what does that print for you?

Question nr 2: do you have by chance any package.json, package_lock.json, node_module files in your homedirectory?

No worries, thank for the response!

1 -

image

2 - I had them before installing zed and after seeing that TS language server couldn't install correctly i remove them and installed Zed again, so I don't have any of those in my home dir now

mrnugget commented 6 months ago

Huh, so it starts for you. Does this work for you?

https://github.com/zed-industries/zed/issues/4524#issuecomment-1913817729

mrnugget commented 6 months ago

Also: does it never start up? In no project? And you also don't have it disabled in your settings, right?

fran122157 commented 6 months ago

No luck downloading the tarball and moving files manually :(

image

I suppose it makes sense because files were already downloading correctly (I see them under ~/Library/Application\ Support/Zed/copilot/copilot-v0.5.0)

Also: does it never start up? In no project? And you also don't have it disabled in your settings, right?

Nope, tried several projects with different languages and the error persists.

I tried disabling copilot and enabling it again but again, no luck.

If disabled it shouldn't show up on the bottom toolbar right?? Just to make sure

image
mrnugget commented 6 months ago

Coming back to Copilot logs: when you run debug: open language server logs, do you not see copilot in this list here?

screenshot-2024-02-20-17 32 16@2x

fran122157 commented 6 months ago

mmmm nope :/

image
mrnugget commented 6 months ago

Okay, we also just found another bug: copilot only shows up in this list in 1 of possibly many Zed windows. So if you want to see the copilot logs, you should close all Zed windows and only open 1, then open the debug view.

fran122157 commented 6 months ago

Yeap, even with just one zed window open I don't see them

mrnugget commented 6 months ago

Do you want to try and download a custom build of Zed?

You can find it here: https://github.com/zed-industries/zed/actions/runs/7977099578?pr=8075 screenshot-2024-02-20-19 16 09@2x

That contains more logging.

So, ideally you'd

  1. Download and install that version of Zed (don't start it yet!)
  2. rm -rf ~/Library/Application\ Support/Zed
  3. Start this version of Zed
  4. Check logs in ~/Library/Logs/Zed/Zed.log (there should be more in there now!)
  5. Check whether copilot logs now show up in debug view
fran122157 commented 6 months ago
"/Users/francisco/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node", working directory: "/", args: ["/Users/francisco/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-02-20T15:28:41-03:00 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-02-20T18:28:41.412Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-02-20T18:28:41.412Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-02-20T15:28:41-03:00 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "03db6bdb-3441-4798-a369-45c6638c478a",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-02-20T15:28:41-03:00 [ERROR] failed to deserialize response from language server: missing field `user`. Response from language server: "{\"status\":\"OK\"}"
2024-02-20T15:28:41-03:00 [ERROR] crates/lsp/src/lsp.rs:682: oneshot canceled
2024-02-20T15:28:47-03:00 [INFO] build git repository ".git"
2024-02-20T15:28:49-03:00 [INFO] build git repository ".git"

Zed.log

EDIT: not seeing copilot in the language server logs selector though

image
mrnugget commented 6 months ago

Alright, we got something (I still don't know why the logs don't show up in the UI though).

This log line here:

2024-02-20T15:28:41-03:00 [ERROR] failed to deserialize response from language server: missing field `user`. Response from language server: "{\"status\":\"OK\"}"

That means copilot doesn't send back your username even though it sends an OK as a reply to our checkStatus message.

Here's what it looks like for me when my Zed talks to copilot:

[2024-02-21T10:15:53+01:00 TRACE lsp] outgoing message:{"jsonrpc":"2.0","id":1,"method":"checkStatus","params":{"localChecksOnly":false}}
[2024-02-21T10:15:53+01:00 TRACE lsp] incoming message: {"jsonrpc":"2.0","id":1,"result":{"status":"OK","user":"mrnugget"}}
[2024-02-21T10:15:53+01:00 TRACE lsp] Took 325.876667ms to receive response to "checkStatus" id 1

We deserialize the message here: https://github.com/zed-industries/zed/blob/1b535e7b28aa3bf84bbc1141e29aca7560d8882c/crates/copilot/src/request.rs#L50-L69

Looking at the Vim implementation it looks like user is not set if the user is not authorized:

https://github.com/github/copilot.vim/blob/1a284014d2e0baf367706a94b2a9ee5fd56fd457/autoload/copilot.vim#L574-L579

Others don't seem to do the check:

https://github.com/gobijan/nova-copilot-lsp/blob/60b2d0183b233f99dd03775b331dd304d235c4f1/Scripts/copilot/commands.js#L42

But I opened https://github.com/zed-industries/zed/pull/8116 to do the same check and handle this case just like copilot.vim does.

That leaves us with:

  1. Why doesn't copilot send back your username? I couldn't find anything about that online. The protocol that copilot uses isn't documented. I do think handling the "failed to deserialize" case makes sense.
  2. Are you signed in to copilot? Does your GitHub account have access to Copilot?
mrnugget commented 6 months ago

Besides what I wrote above, here are some next steps:

  1. Close all Zed windows and instances you have running.
  2. Delete your local copilot state:
    rm -rf ~/.config/github-copilot
    rm -rf ~/Library/Application\ Support/Zed/copilot
  3. Go here and download the .dmg at the bottom: https://github.com/zed-industries/zed/actions/runs/7987345661?pr=8116 This one includes my fix for the cannot deserialize error
  4. Start that new Zed version, sign-in to copilot
fran122157 commented 6 months ago

Sorry! I had a draft comment and never sent it.

Yes, before creating the post, one of the first things I did was to to log out and log in again.

That's why in the original post I mentioned the following, I did it Because I noticed that after clicking log in it did it automatically and didn't sent me to Github like the first time. Maybe something went wrong with the login process and wanted to do a fresh start

I'm currently logged in with this Github account (which has access to copilot)

image
fran122157 commented 6 months ago

Besides what I wrote above, here are some next steps:

  1. Close all Zed windows and instances you have running.
  2. Delete your local copilot state:
rm -rf ~/.config/github-copilot
rm -rf ~/Library/Application\ Support/Zed/copilot
  1. Go here and download the .dmg at the bottom: https://github.com/zed-industries/zed/actions/runs/7987345661?pr=8116 This one includes my fix for the cannot deserialize error
  2. Start that new Zed version, sign-in to copilot

This did the trick!

image
mrnugget commented 6 months ago

Okay. I still don't understand exactly why/how your login status was a bit borked, but happy to hear that resettting fixed it. So I'm going to close this as fixed by #8116.

avi-cenna commented 4 months ago

If anyone else has this issue, I can confirm that the approach of (1) deleting the copilot cache directories and then (2) reinstalling Zed by downloading the official .dmg file works. I am using ZScaler, and Copilot was having an issue getting the local issuer certificate.

As specified above, the commands to delete the cache dirs are as follows:

rm -rf ~/.config/github-copilot
rm -rf ~/Library/Application\ Support/Zed/copilot