code-server icon indicating copy to clipboard operation
code-server copied to clipboard

code-server automatically opens notebooks and changes metadata on start

Open sgrenf95 opened this issue 5 months ago • 6 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

OS/Web Information

  • Web Browser: Microsoft Edge
  • Local OS: Amazon Linux 2023
  • Remote OS: Amazon Linux 2023
  • Remote Architecture:
  • code-server --version: 4.98.0

Steps to Reproduce

  1. Clone a git repository in your code-server environment
  2. Create a jupyter notebook in the git repository (let's call it test.ipynb)
  3. Open the test.ipynb file in the JupyterLab environment (NOT code-server) and edit it
  4. Git commit the edits from the JupyterLab terminal: git add . and then git commit -m "test commit"
  5. Now open the code-server environment:
  • The first strange thing is that the test.ipynb file will open automatically.

  • The second strange thing is that it edits the metadata of the notebook:

Image

Expected

  1. It shouldn't open the test.ipynb file automatically in the code-server environment.
  2. it shouldn't edit the notebook metadata.

Actual

  1. It opens the test.ipynb file automatically in the code-server environment.
  2. It edits the notebook metadata.

Does this bug reproduce in native VS Code?

This cannot be tested in native VS Code

Does this bug reproduce in GitHub Codespaces?

This cannot be tested in GitHub Codespaces

Are you accessing code-server over a secure context?

  • [x] I am using a secure context.

Notes

My code-server environment runs inside a Docker container. In this container I have installed:

  • jupyterlab: 4.4.2
  • jupyterlab_server: 2.27.3
  • jupyterhub: 1.5.0
  • code-server: 4.98.0

Also note that if I create a new Jupyter Notebook from code-server, these are the metadata I see:

Image

While, if I create a new Jupyter Notebook in the Jupyterlab environment, these are the metadata I see:

Image

sgrenf95 avatar Jun 30 '25 09:06 sgrenf95

Does it still happen if you clear your browser data? I wonder if VS Code is remembering that the file was opened previously, so it opens it again. Not sure about the metadata though, unless the file had been edited without saving and VS Code is restoring the unsaved edits or something.

code-asher avatar Jun 30 '25 19:06 code-asher

Thank you @code-asher for the reply. I tried to clear the browser data but still the issue persists.

sgrenf95 avatar Jul 01 '25 07:07 sgrenf95

Ah bummer. I tried creating a notebook with JupyterLab, committing it with git, then launching code-server, but I only see the welcome screen. I am using 4.101.2 though.

code-asher avatar Jul 02 '25 21:07 code-asher

Hello @code-asher and sorry for the late reply. I upgraded code-server to latest version 4.101.2, but the issue still persists. Basically the issue is that if I create a new notebook in JupyterLab:

Image

Then in the kernelspec metadata I have by default "display_name": "Python [conda env:base] *", BUT, if I open the same notebook in code-server, then the display_name of the default kernel changes:

Image

sgrenf95 avatar Jul 10 '25 09:07 sgrenf95

Quite strange, I have not been able to reproduce unfortunately. Does it still happen if you uninstall extensions? I wonder if the extension is for some reason modifying the file.

code-asher avatar Jul 16 '25 21:07 code-asher

I'm also seeing this on my desktop version of VS Code, what extensions do you have setup? I tried looking at my logs and I'm not seeing anything super glaring.

TWDickson avatar Jul 17 '25 13:07 TWDickson