sourcegraph / sg.nvim

Experimental Sourcegraph + Cody plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cody completions and chat not working (NixOS)

jgero opened this issue · comments

checkhealth sg:


==============================================================================
sg: require("sg.health").check()

sg.nvim report ~
- Machine: x86_64, sysname: Linux
- OK Valid nvim version: table: 0x7f74c7be4078
- OK Found `cargo` (cargo 1.73.0) is executable
-     Use `:SourcegraphDownloadBinaries` to avoid building locally.
- OK Found `sg-nvim-agent`: "/nix/store/2p04ma8rf1jdjs944r356zq6b2lz8d3a-vim-pack-dir/pack/myNeovimPackages/start/sg.nvim/target/debug/sg-nvim-agent"
- OK Found `node` (config.node_executable) is executable.
  Version: '21.2.0'
- OK Found `cody-agent`: /nix/store/2p04ma8rf1jdjs944r356zq6b2lz8d3a-vim-pack-dir/pack/myNeovimPackages/start/sg.nvim/dist/cody-agent.js
- OK   Authentication setup correctly
- OK     endpoint set to: https://sourcegraph.com
- OK Found correct binary versions: "1.0.8" = "1.0.8"
- OK   Sourcegraph Connection info: {
  access_token_set = true,
  endpoint = "https://sourcegraph.com",
  sg_nvim_version = "1.0.8",
  sourcegraph_version = {
  build = "263357_2024-02-27_5.3-24bd456b076e",
  product = "263357_2024-02-27_5.3-24bd456b076e"
  }
  }
- To manage your Cody Account, navigate to: https://sourcegraph.com/cody/manage
- OK Cody Account Information: {
  chat_limit = 0,
  chat_usage = 29,
  code_limit = 0,
  code_usage = 662,
  cody_pro_enabled = true,
  username = "mail-wltvz"
  }
- OK sg.nvim is ready to run

SourcegraphSearch works, but none of the Cody features do. There are no completion suggestions and the cody chat windows are always stuck in the "loading" state. If i trigger the autocompletion manually via the lua API I get

Unable to get token and/or endpoint for sourcegraph. Use `:SourcegraphLogin` or `:help sg` for more information

Since the checkhealth says authentication is working and cody is ready I'd guess maybe somewhere in the process the auth token is not passed correctly. How do I debug further to find out where the token may get lost?

I'm experiencing the same issue with near-enough the same :checkhealth sg report on

@yassiezar Have you found any more clues if it's really a missing env variable because of nixos?

I'm actually seeing this behaviour on both my Fedora 39 and Debian 10 machines, so it might not be related to NixOS.

One other datum is that I get an authentication failure message in the bottom-right when I start nvim (see below), but the checkhealth page says I'm logged in. Maybe Sourgraph search and Cody use different authentication APIs, with the latter not yet configured correctly for enterprise/pro logins from sg.nvim?

image

That would make a lot of sense, because cody worked for me a few days ago when I was still on the free tier. It stopped working when I switched to a pro subscription.

Okay I'm not sure what happened but for some reason it started working again today, I didn't change a thing on my setup. @yassiezar did you experience the same behavior?

Nevermind, today it's not working again, I can't even log in...

Nevermind, today it's not working again, I can't even log in...

I'm stupid, my token expired...