Open xaverhimmelsbach opened 3 months ago
I face the same issue
My helix logs also shows
helix_lsp [ERROR] failed to initialize language server: request 0 timed out
I tried both using bun, and built my own executable using bun build. Same results for both.
My config (with the path edited and api key redacted):
[language-server.gpt]
command = "bun"
args = ["run", "/path/to/helix-gpt", "--handler", "copilot", "--copilotApiKey", "redacted"]
[[language]]
name = "go"
language-servers = [
"gopls",
"gpt"
]
I am getting the same issue on NixOS using Codeium.
I resolved this issue by going back to version 0.28. It seems 0.31 is simply broken.
Its a bug in bun, either use an old version, or use my deno fork https://github.com/sigmaSd/helix-gpt
Obviously the best thing is to find whats the issue exactly to report it to the bun devs
Its a bug in bun, either use an old version, or use my deno fork https://github.com/sigmaSd/helix-gpt
Obviously the best thing is to find whats the issue exactly to report it to the bun devs
Thanks @sigmaSd. I got it working using deno and your fork.
Its a bug in bun, either use an old version, or use my deno fork https://github.com/sigmaSd/helix-gpt
Obviously the best thing is to find whats the issue exactly to report it to the bun devs
Works flawlessly, thank you so much! I'm closing this issue for now, hopefully bun will fix this error. Otherwise @sigmaSd have you thought about opening a PR for deno support?
I opened a PR already https://github.com/leona/helix-gpt/pull/45 but then I thought maybe its too many changes and its better kept as a fork, obviously if @leona is interested I can reopen it
I narrowed the issue down to between Bun version 1.0.29, exclusive, and 1.0.35, inclusive.
I think this issue should stay open for visibility while there's no warning on the README Thank you @sigmaSd
EDIT: what are version 0.30 and 0.31? there's no release logs and no changes in files as far as I can see
EDIT2: @justinlovinger
I resolved this issue by going back to version 0.28. I had no luck running 0.28 either, not sure what I'm doing wrong at this point.
0.28 broken for me either
[language-server.gpt]
command = "deno"
args = ["run", "--allow-env", "--allow-net", "/usr/local/bin/helix-gpt-0.31.js",
"--logFile", "/Users/f.abapoov/gpt.log", "--handler", "copilot"]
Am I doing it right? deno installed with brew but nothing works
@pheepa
I was not sure how to do it, did not find releases in your fork
I can just clone repo and refer to src/app.ts instead of /usr/local/bin/helix-gpt-0.31.js?
Yes or if you want to use the easiest way you can just deno run url_to_app.js
for example deno run --allow-net --allow-env https://raw.githubusercontent.com/sigmaSd/helix-gpt/421f4ef14a7d23d102bfec3cba24899cbbeda682/src/app.ts
will run the current latest commit on my fork
I updated the usage instruction to make it simpler
**Usage:**
The fork have tags that follows upstream but with `-deno` suffix, for example `0.31-deno`
To run with deno
deno run --allow-env --allow-net https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts --handler codeium` # make sure to use the latest deno tag
To compile to a standalone executable
deno compile --output helix-gpt --no-check --allow-env --allow-net https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts # make sure to use the latest deno tag
@sigmaSd
Thanks, but, what do I put on the languages.toml with your fork then?
[language-server.gpt]
command = "deno"
args = ["run", "--allow-net","--allow-env", "https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts"]
# HANDLER can be set to openai/copilot/codeium
environment = { HANDLER= "codeium" }
Managed to make it work, thank you, it doesn't feel right to be executing a remote file with --allow-net
tho, any thoughts on that?
I just cloned and refered to helix-gpt/src/app.ts, everything works
Managed to make it work, thank you, it doesn't feel right to be executing a remote file with
--allow-net
tho, any thoughts on that?
My arguments
tldr deno only uses net and env permission but no read/write/ffi/run, I think this is secure
- the remote module is cached locally by deno on first access
I guess it'll eventually retrieve it again, right?
- the net permission is needed to speak with the ai apis (codeium/openai ,etc)
I personally did this for copilot:
--allow-net=api.github.com,copilot-proxy.githubusercontent.com,api.githubcopilot.com
- there is no read or write permission!, only net and env, I can't imagine you can do many things with it
Well, you never know, just check the xz
drama lately.
tldr deno only uses net and env permission but no read/write/ffi/run, I think this is secure
Just to be sure I did:
deno compile --output helix-gpt --no-check --allow-env --allow-net=api.github.com,copilot-proxy.githubusercontent.com,api.githubcopilot.com https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts
Then move that to /bin
sudo mv helix-gpt /usr/local/bin/helix-gpt
And then on languages.toml
[language-server.gpt]
command = "helix-gpt"
environment = { HANDLER= "copilot", COPILOT_API_KEY="***"}
So with this approach I'm not executing a remote file and only has the net permission for what it needs.
Out of curiosity, is it easy to see what changes on your fork from main somehow?
Regardless, thank you again.
Hi, this is such an awesome project. Makes helix so much better. The nix package is also giving me this issue. Would be great if @leona could give an idea of whether we should use the fork or if there is another option. The fork with deno is working for me in the interim.
Hi, this is such an awesome project. Makes helix so much better. The nix package is also giving me this issue. Would be great if @leona could give an idea of whether we should use the fork or if there is another option. The fork with deno is working for me in the interim.
For Nixpkgs, you can pin bun
to a working version. This is what I did using Flakes,
helix-gpt = nixpkgs-unstable.legacyPackages.${system}.helix-gpt.override {
bun = inputs.nixpkgs-working-bun.legacyPackages.${system}.bun;
};
where inputs.nixpkgs-working-bun
is nixpkgs-working-bun.url = "github:nixos/nixpkgs/9e58aca561e18f5197029926db8dbde1738a2ff5";
. You can do the similar without Flakes if you are not using them.
@justinlovinger You're a lifesaver!
Isn't there any workaround for this? where can I find more info about the bug on bun?
device info Apple M2 Pro
helix-editor version helix 23.10 (1d1806c8)
helix-gpt version 0.31
Describe the bug The initialization request from Helix times out when opening a file for which helix-gpt is configured to run. helix-gpt waits in src/models/lsp.ts in line 207 for Chunks from. Bun.stdin.stream() but nothing ever arrives. I checked this by logging the chunkText.
If I start helix-gpt manually with
the input is read from stdin:
helix-gpt logs Most of the time, helix-gpt justs prints the triggerCharacters and receives nothing more. Sometimes, when repeatedly executing :lsp-restart in Helix, an initialization request comes through, but that still doesn't seem to be handled correctly.
These logs show the request showing up after repeatedly calling :lsp-restart:
helix logs Helix seems to send the initialization request and times out after 10 seconds (default LSP timeout). Increasing the timeout in languages.toml just led to longer waiting times.