Get help from the marimo community

Updated 2 months ago

Unable to connect to github copilot

At a glance

A community member is trying to enable GitHub Copilot in Marimo, but is unable to connect. They are running Marimo on a remote machine with a private IP. Other community members suggest using the --proxy and --host flags to address the issue, but the community member still faces problems. After further debugging, they discover that the Copilot script Marimo is trying to run is missing, and they create a pull request to address this. Another community member facing a similar issue with Tailscale asks for tips.

Useful resources
Hi - just started using Marimo and it looks pretty nifty!

I have been trying to enable github copilot with it but can't seem to. When I select it in the settings, it just says "Unable to connect" and I can't find any debugging info in the repository, or the logs.

I am running Marimo on a remote machine with a private IP set to host, might that be the issue?

rye run marimo edit --host {private-ip} --no-token
1
D
d
a
14 comments
I have exactly the same problem, but I am running Marimo locally. So this seems not to be your issue.
You have to run the --proxy={private-ip}

--host just restricts the ip interface for access to the server
Can you help me understand how will that make copilot work?

I can access Marimo by setting the host variable fine. Using proxy={private-ip} leaves me this

Plain Text
        Create or edit notebooks in your browser πŸ“

        URL: http://100.106.136.158


And I can't seem to access Marimo at all, at http://100.106.136.158:2718
Yup. So, copilot runs on another server in the background, and assumes that the way marimo is connecting is the same way it should connect.

--host=localhost is the default, and restricts access to the server unless the request comes from localhost. So that's why you can't connect now, you still need --host={private IP}

--proxy was set up for domains (e.g. your server is notebooks.company.co). Actually since you are running with a raw IP, I don't think this is needed, but give it a shot.

Do you have node installed on your server?
Thank you. So, this lets me access Marimo at {private-ip}:2718.

Plain Text
$ rye run marimo edit --host 100.106.136.158 --no-token --proxy 100.106.136.158

        Create or edit notebooks in your browser πŸ“

        URL: http://100.106.136.158


Copilot still fails to connect though. I have node installed. Is there a wy to enable debug logs for the server process?
marimo -d -l DEBUG edit --host 100.106.136.158 --no-token --proxy 100.106.136.158 --port=2718

For full verbosity. It could also be a firewall issue if 27180 is blocked
Thank you for helping me through it! After running this command, here are the logs when I toggle "AI code completion" in Marimo UI from None to Github.

Weirdly, code-autocomplete requests seem to be successful in the terminal logs, but frontend still says "unable to connect" and I don't actually see it.
Did you check your firewall? Also, if you pop developer tools, it should let know know why the request fails
Yep. The private IP comes from using tailscale vpn which doesn't need you to open any ports on firewall. I think that isn't an issue because I created a simple WS server on 27190, and can seemingly access it from my browser, at "ws://http://100.106.136.158:27190/"

Plain Text
ubuntu@ip-10-0-0-6:~$ netstat -tuln | grep 271
tcp        0      0 100.106.136.158:2718    0.0.0.0:*               LISTEN
tcp6       0      0 :::27180                :::*                    LISTEN
tcp6       0      0 :::27190                :::*                    LISTEN


The first entry is the marimo server, second one is the copilot one(?) and the third one is the test WS server, which is accessible from the browser.

From dev tools, I can see a WS connection request from the frontend to 27180, but it doesn't seem to receive a response.

Console logs from dev tools show the following error, and sometimes about a websocket being already closed (but I cant always get it to appear)
Plain Text
Uncaught (in promise) Error: Request timeout request took longer than 30000 ms to resolve
    at new n (icons-BeupAtiJ.js:13:128755)
    at icons-BeupAtiJ.js:13:131481
I think I got it. I set up the Marim repo locally and added logging here - https://github.com/marimo-team/marimo/blob/293e3cd122ed5f8cdc5ae2b9a4d22498ef92fe9e/lsp/index.ts#L52

Plain Text
New client connected with url:  /copilot
Forwarding new client
local Server: node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module '/home/ubuntu/repos/marimo/marimo/_lsp/copilot/dist/agent.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.10.0


So, the copilot script Marimo LSP server wants to run seems to be missing. Looking at the original package, there actually isn't an agent.js, nor there is one in the compiled LSP package by Marimo. I am not sure how it works at all!

Plain Text
ubuntu@ip-10-0-0-6:~/repos/marimo/lsp/node_modules/copilot-node-server/copilot/dist$ ls
compiled      language-server.js  tree-sitter-go.wasm          tree-sitter-python.wasm  tree-sitter-tsx.wasm         tree-sitter.wasm
crypt32.node  resources           tree-sitter-javascript.wasm  tree-sitter-ruby.wasm    tree-sitter-typescript.wasm
Ah, seems like the script name has changed - https://github.com/rstudio/rstudio/issues/14800
Hi, I'm facing similar issue and I'm also using tailscale to connect to a remote notebook server. Any tips?
Add a reply
Sign up and join the conversation on Discord