Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Workspace while another Workspace is open doesn't work. #3061

Closed
SJang1 opened this issue Apr 7, 2021 · 58 comments
Closed

Open Workspace while another Workspace is open doesn't work. #3061

SJang1 opened this issue Apr 7, 2021 · 58 comments
Assignees
Labels
bug Something isn't working

Comments

@SJang1
Copy link

SJang1 commented Apr 7, 2021

OS/Web Information

  • Web Browser: Firefox 87.0
  • Local OS: M1 Macbook Air, MacOS 11.2.3
  • Remote OS: Ubuntu 20.04
  • Remote Architecture: x64
  • code-server --version: 3.9.2 109d2ce

Steps to Reproduce

  1. Open and work on the workspace
  2. Click menu bar left top corner -> File -> Open Workspace
  3. Try to open

Expected

New workspace should open

Actual

Nothing happens
and it also cd..s on the input area or says Please select a file.

Screenshot

2021-04-07.10.32.19.mov

Notes

This issue can be reproduced in VS Code: No
At the video I attached has language that is not in English, but that is NOT why this happens.

@jsjoeio
Copy link
Contributor

jsjoeio commented Apr 7, 2021

This is very strange. I was able to reproduce locally. Opening a workspace is not working. There are no logs in the console. And running code-server with --log debug shows no unusual messages.

Screen.Recording.2021-04-07.at.10.35.00.AM.mov

This is definitely a bug. Thank you for reporting! We'll investigate.

@jsjoeio jsjoeio added the bug Something isn't working label Apr 7, 2021
@jsjoeio jsjoeio added this to the On Deck milestone Apr 7, 2021
@SJang1
Copy link
Author

SJang1 commented Apr 8, 2021

Update: There was no any unusual log on my side either. (On both server/client with --log debug like that video in the comment.)

@SJang1
Copy link
Author

SJang1 commented Apr 9, 2021

Finally got an error on the client-side on 3.9.3 fe2dc2d when trying to press OK button on the Open Workspace.
No unusual logs on the server-side even for now.

  ERR B is undefined: onDidAccept@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:26098
q@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:23196
q/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:23154
fire@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:1836
set busy@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:19194
updateItems/H</<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:33533
promise callback*updateItems/H<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:32976
y@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:16608
updateItems@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:32904
tryUpdateItems@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:27831
async*handleValueChange@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:24504
insertText@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:30377
onDidAccept@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:26618
q@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:23196
pickResource/</<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:23319
fire@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:1836
show/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:568:27922
fire@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:1836
getUI/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:568:37685
fire@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:1836
g/</<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:46669
EventListener.handleEvent*a@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:68:6348
s@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:68:6571
g/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:46563
g@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:46534
getUI@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:568:37585
createQuickPick@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:568:42870
createQuickPick@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:658:77837
pickResource/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:21499
pickResource@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:21434
async*showOpenDialog@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1841:19430
async*pickResource@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1842:2754
pickWorkspaceAndOpenSimplified@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1842:1944
pickWorkspaceAndOpen@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1842:5010
Async*run@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:2743:81214
triggerAndDisposeAction@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1693:61398
async*createCommandHandler/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1693:61105
invokeFunction@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:622:29963
_tryExecuteCommand@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1645:3492
executeCommand/<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1645:3241
promise callback*executeCommand@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1645:3228
H/J<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:1768:4000
run@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:30024
runAction@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:30556
run@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:30423
onClick@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:33588
o/this.runOnceToEnableMouseUp</<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:106904
EventListener.handleEvent*a@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:68:6348
s@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:68:6571
o/this.runOnceToEnableMouseUp<@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:171:106748
doRun@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:23298
onTimeout@https://code-server-desktop.sjang.dev/static/fe2dc2deb08e378069891b622bb62ad1d261d1b1/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js:57:23264

@jsjoeio
Copy link
Contributor

jsjoeio commented Apr 12, 2021

Interesting! Well at least this is a starting point :) Thanks for the update @SJang1 !

@stale
Copy link

stale bot commented Oct 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.

@stale stale bot added the stale label Oct 9, 2021
@SJang1
Copy link
Author

SJang1 commented Oct 10, 2021

(still presents

@stale stale bot removed the stale label Oct 10, 2021
@stale
Copy link

stale bot commented Apr 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.

@stale stale bot added the stale label Apr 8, 2022
@SJang1
Copy link
Author

SJang1 commented Apr 9, 2022

(still presents

@stale stale bot removed the stale label Apr 9, 2022
@spkane
Copy link

spkane commented Oct 5, 2023

@jsjoeio Has anyone had time to look at this? I see similar behavior when using "Open workspace from file." Sometimes, it loads, but it frequently hangs with the explorer trying to refresh forever.

I have seen the same behavior when trying to use any of the workspace-switching extensions like these:

CleanShot 2023-10-05 at 09 52 33

@spkane
Copy link

spkane commented Oct 5, 2023

In my case, it appears that this might work with a single browser, but it exhibits the issue immediately when two browsers have the code-server UI open and the second one tries to load a new workspace file.

@spkane
Copy link

spkane commented Oct 5, 2023

This might be related to: #2161

Although the details seem a bit different. I can see terminals and windows in general but can not open a new workspace from the other browser.

cc/ @code-asher

@code-asher
Copy link
Member

I think I am seeing the same thing. In my case I opened a workspace file, copied the URL, then pasted that into a new tab and in the new tab the file explorer, git, and debug are empty or hung for me. Terminal and extensions are fine. Search works, interestingly, and I can open files from there.

I was not able to reproduce in Codespaces. I think there they run separate instances for each connection so that might have something to do with it. In any case it probably means we will need to patch it from here. I might be able to take a deeper look in a couple weeks.

@code-asher code-asher self-assigned this Oct 5, 2023
@spkane
Copy link

spkane commented Oct 6, 2023

@code-asher That would be great. If there is any additional information that I can gather, please let me know.

Getting this fixed would resolve a pretty significant issue that we are having currently when using code-server.

@tammersaleh
Copy link

I've love to see this fixed - we'd also be happy to sponsor the fix, if that helps.

@code-asher
Copy link
Member

It looks like I am not going to be able to get to this in the next two weeks, and I am going to be away from my keyboard for a few weeks after that, but I will try to check in periodically in case someone takes this up and submits a PR. If not I will see about scheduling some time for it after I get back.

@spkane
Copy link

spkane commented Oct 12, 2023

It looks like I am not going to be able to get to this in the next two weeks, and I am going to be away from my keyboard for a few weeks after that, but I will try to check in periodically in case someone takes this up and submits a PR. If not I will see about scheduling some time for it after I get back.

Understood. Thank you @code-asher


Some additional details

While searching for a workaround, I was also able to reproduce this issue just by starting up code-server via systemd with a multi-folder workspace file, launching a private/incognito browsing window to https://code.example.com/, and logging in. The browser would redirect to https://code.example.com/?workspace=/home/me/.vscode/default.code-workspace and often show the same symptoms. Sometimes, it works initially, but a refresh in the browser window always causes it to break. There doesn't appear to be a need for a second browser window to trigger this.

  • systemd unit file
[Unit]
Description=code-server
After=network.target

[Service]
# This environment variable is set to "trick" the Golang extension
# see: https://github.com/golang/vscode-go/issues/1246
Environment="CLOUD_SHELL=true"
Type=exec
WorkingDirectory=~
ExecStart=/usr/bin/code-server ./.vscode/default.code-workspace
Restart=always
User=%i

[Install]
WantedBy=default.target
  • VSCode workspace file
{
  "folders": [
    {
       "name": "project1",
       "path": "/home/me/project1"
    },
    {
      "name": "project2",
      "path": "/home/me/project2"
    },
  ],
  "settings": {
    "explorer.expandSingleFolderWorkspaces": false,
    "explorer.fileNesting.enabled": false
  }
}

In this example, code-server is started with a command like sudo systemctl start code-server@me.

@spkane
Copy link

spkane commented Oct 19, 2023

I cannot reproduce this problem in Gitpod's openvscode-server, so it appears like this is specific to code-server.

I tested this with:

docker run -it --init -p 3000:3000 -v "$(pwd):/home/workspace:cached" gitpod/openvscode-server

Running this and then opening up a multi-root workspace work fine. Refreshing works fine, and opening the workspace up from another browser appears to work fine as well.

@spkane
Copy link

spkane commented Oct 19, 2023

This issue is definitely code-server specific. I can quickly reproduce it in a code-server docker container using the following command and then opening up a workspace file.

docker run -it --rm --name code-server -p 127.0.0.1:8080:8080 -v "$HOME/.config:/home/coder/.config" -v "$PWD:/home/coder/project" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" codercom/code-server:latest

@benz0li
Copy link
Contributor

benz0li commented Nov 21, 2023

I was trying to build myself. Any idea what I should set for VERSION?

My basic workflow from scratch:

Update Code

  1. Clone repository
    git clone https://github.com/coder/code-server.git
  2. Update VS Code submodule to the new version
    cd code-server
    git submodule init
    git submodule update --remote
    cd lib/vscode
    git checkout 1.84.2
    cd ../..
  3. quilt push -f
    • If there are conflicts then resolve them
  4. quilt refresh
    • Back to step three until there are no more patches

❗ Usually checking out a tag (e.g git checkout 1.84.2), but the current release is based on git checkout 1a5daa3a

Set version

export VERSION='4.20.0-rc.1'

Install dependencies

yarn

Build code-server

yarn build
yarn build:vscode
KEEP_MODULES=1 yarn release

Modify version

npm version --prefix release "$VERSION"
tmp=$(mktemp)
jq ".codeServerVersion = \"$VERSION\"" release/lib/vscode/product.json > "$tmp" && mv "$tmp" release/lib/vscode/product.json
chmod 644 release/lib/vscode/product.json

Build release packages

yarn release:standalone
yarn test:integration
yarn package

Then, I deploy at https://coder.jupyter.b-data.ch/ (image R (base:test-devtools-docker)) and test some functionality manually.

See also https://coder.com/docs/code-server/latest/CONTRIBUTING

@bilogic
Copy link

bilogic commented Nov 21, 2023

Wow thanks! Yea, I was reading up, made my way through several errors. But it is faster to try your .deb. Thanks! :)

@benz0li
Copy link
Contributor

benz0li commented Nov 21, 2023

P.S.: Image glcr.b-data.ch/jupyterlab/python/base:latest-devtools has everything installed to build code-server (using code-server).
ℹ️ For more information, see https://github.com/b-data/jupyterlab-python-docker-stack.

@code-asher
Copy link
Member

@benz0li thank you for providing a release to test! I tried to put out a release candidate yesterday but for some reason the e2e test keeps failing...still looking into it.

@benz0li
Copy link
Contributor

benz0li commented Nov 21, 2023

@benz0li thank you for providing a release to test!

My pleasure.

I tried to put out a release candidate yesterday but for some reason the e2e test keeps failing...

No worries.

still looking into it.

Thanks for all your efforts. Much appreciated – as always.

@code-asher
Copy link
Member

Finally put up a release candidate. I would love to hear confirmation on whether the issue is resolved from anyone that was having the issue.

@lplassman
Copy link

Issue appears to be fixed for me after testing with multiple browsers and across workspace reloads. Thank you for the prompt resolution of this issue! Greatly appreciated!

@bilogic
Copy link

bilogic commented Nov 21, 2023

@code-asher @benz0li

4.19.1-rc.1 is broken on mine.

  1. My existing theme is gone, becomes a very white theme instead,
  2. My settings also seems gone, because I have the command bar at the top disabled, but it's showing now
  3. Not sure what else is broken.
  4. Many of my settings are stored in ~/.config/code-server and ~/code-server/user, what are the correct locations now?

4.19.0

image

4.19.1-rc.1

image

@benz0li
Copy link
Contributor

benz0li commented Nov 22, 2023

@bilogic Please be aware of commit 09dd5fe, i.e. pre-populated settings being moved from ~/.local/share/code-server/User/settings.json1 to ~/.local/share/code-server/Machine/settings.json2.
ℹ️ From now on, User settings will be stored in browser.

Footnotes

  1. User settings, stored on disk; obsolete

  2. Remote settings, stored on disk

@bilogic
Copy link

bilogic commented Nov 22, 2023

Let me test later thanks. How is a user supposed to retain their settings across machines then?

@benz0li
Copy link
Contributor

benz0li commented Nov 22, 2023

Finally put up a release candidate.

Thank you.

I would love to hear confirmation on whether the issue is resolved from anyone that was having the issue.

@code-asher I can confirm that

  1. this issue seems to be resolved.
  2. smoke tests1 were successful.

code-server-4.19.1-rc.1-linux-amd64.tar.gz with Code 1.84.2 is deployed at https://coder.jupyter.b-data.ch; Image R (base:test-devtools-docker).

Footnotes

  1. https://github.com/coder/code-server/pull/6519#issuecomment-1798103811

@benz0li
Copy link
Contributor

benz0li commented Nov 22, 2023

How is a user supposed to retain their settings across machines then?

@bilogic How have you done this so far?

@benz0li
Copy link
Contributor

benz0li commented Nov 22, 2023

@bilogic 'Folder settings' overwrite 'Workspace settings' overwrite 'Remote settings' (Machine settings) overwrite 'User settings' overwrite 'Default settings'.

@bilogic
Copy link

bilogic commented Nov 22, 2023

@benz0li

So what I understand about VSCode is:

  1. Start with user settings on server

  2. Overwrite with machine settings on server

  3. Overwrite with workspace settings on server

  4. Overwrite with folder setttings on server

  5. Developers get to store their customizations in user, and this gives the same customized settings even on new machines

  6. Then, there are "company" defaults stored in Machine.json, e.g. debugger ports, allocated by the "company" and these can vary between developers and not supposed to be modified in any way (I have a script that overwrites them regularly)

  7. I use workspace to store project settings, they contain minimal settings, mainly folder paths settings

  8. So, what is broken now for me is 5, developers have to "memorize" their changes, and redo them when faced with a new machine

  9. If I understand correctly, this change comes from code-server, yes? If so, I would suggest restoring 1 and adding a 0, where 0 loads from the browser, a little complicated, but this achieves the new behavior + retain old behavior

Proposed new behavior

  1. Load settings from browser (can be individualized, use case: developer personal preferences, can't sync across machines)
  2. Overwrite with user settings on server (can be individualized, use case: developer personal preferences, sync across machines)
  3. Overwrite with machine settings on server (can be individualized, use case: developer devops settings)
  4. Overwrite with workspace settings on server (can't be individualized as it is commited to git)
  5. Overwrite with folder settings on server (can't be individualized as it is commited to git)

@bilogic
Copy link

bilogic commented Nov 22, 2023

@code-asher what do you think? Should I start another issue for it? Thanks.

@benz0li
Copy link
Contributor

benz0li commented Nov 22, 2023

Should I start another issue for it? Thanks.

@bilogic Yes, please.

Please keep the following in mind:

So what I understand about VSCode is:

  1. Start with user settings on server

code-server is not VS Code [+ Dev Container] but is instead similar to Codespaces.

Proposed new behavior

...
2. Overwrite with user settings on server (can be individualized, use case: developer personal preferences, sync across machines)

IMHO not going to happen; Reverted by 09dd5fe
👉 Same behaviour as Codespaces now. Use 'Remote settings' (Machine settings) instead.

@spkane
Copy link

spkane commented Nov 22, 2023

Although I have not had the opportunity to test this fix yet, I am guessing that the fix (reverting the local storage patch) actually removed another feature that we rely on in our environment, the ability to set some default User settings which will be pre-set in VScode, without the user needing to set them in each and every browser they open (home, work, etc). This was a core reason we picked code-server over gitpod's implementation.

I'll add this to the new issue that @bilogic is starting.

@code-asher
Copy link
Member

code-asher commented Nov 22, 2023

Oof, sorry about all this. When you edit user settings in VS Code web it saves the settings in browser storage, not on disk, so I was under the impression our patch was no longer doing anything. (Also we have issues like #4263 where the user settings on disk seem to be ignored.)

It seems, though, it does still take effect, or at least partially; perhaps it uses the disk due to our patch under certain conditions (startup maybe), but under other conditions (using the settings menu, for example) it uses browser storage. I would need to experiment more. This incomplete patching is, I think, the cause of this bug.

An alternative, which would preserve the existing behavior, would be to dig into the code and patch it more fully so it uses the disk everywhere instead of browser storage, but I have no idea how extensive this patching will be.

Edit: I was pretty off on this, problem was an improper use of async globals that only manifested with enough delay fetching the settings, which happens when we move settings to the remote. Settings were always being stored correctly, no partial storage was involved.

However, from a maintenance perspective it would be better to keep the patch removed, aligning us with upstream (which stores user settings in browser storage, see Codespaces for example), and for everyone to migrate from user settings to machine settings (basically just rename User/settings.json to Machine/settings.json), but at the same time I am reluctant to release a breaking change especially with a minor or patch bump. We could major bump. Definitely need to make this all clear in the changelog and release notes if we keep the patch removed, regardless of how we bump.

Then again, Microsoft caused the breaking change by changing the behavior from reading from disk to browser storage and they never major bumped, so maybe minor is fine. But since it only affects web maybe they were not very concerned about compatibility. I think when it comes to IDEs folks probably just always download the latest anyway so maybe semver does not have as much meaning as it would with a library or something. Or maybe VS Code uses the version as a way to document plugin API compatibility only, not other things like setting storage locations.

@benz0li
Copy link
Contributor

benz0li commented Nov 22, 2023

Oof, sorry about all this. When you edit user settings in VS Code web it saves the settings in browser storage, not on disk, so I was under the impression our patch was no longer doing anything. (Also we have issues like #4263 where the user settings on disk seem to be ignored.)

'User Settings' are stored on disk and work just fine. Regarding #4263 see #4263 (comment).

However, from a maintenance perspective it would be better to keep the patch removed, aligning us with upstream, and for everyone to migrate from user settings to machine settings (basically just rename User/settings.json to Machine/settings.json),

I agree. I am happy to move from 'User Settings' to 'Remote Settings' (Machine Settings) should the patch be removed.

Codespaces work exactly the same way.

but at the same time I am reluctant to release a breaking change especially with a minor or patch bump. We could major bump. Definitely need to make this all clear in the changelog, if we keep the patch removed.

Yes, this should be a new major version.

@code-asher
Copy link
Member

code-asher commented Nov 22, 2023

Thank you for the input! So right now I think we are leaning toward keeping the patch removed and doing a major bump.

I have a few hours left before the holidays so I might have to pick this back up on Monday, but I am going to just see if I can quickly get the old behavior working while still resolving this bug, just so we know what the alternative looks like. Maybe it will not be so bad...

@spkane
Copy link

spkane commented Nov 23, 2023

Just to be clear the behavior that we are using today, is writing a settings.json file to:

/home/user/.local/share/code-server/User which contains various settings, including things like:

{
  "security.workspace.trust.enabled": false
}

which I am pretty confident are not allowed to be set by any settings layer besides the User one. I do not care if the User changes them after the fact, but I absolutely want to set various settings defaults since our instances are internal, used for very specific use cases and are not used by the general public.

If there is another reasonable way to do this so that these settings will be the default for any browser that opens up the code-server URL, I am happy to change over to that method. Otherwise, I may be stuck on v4.16.1. for awhile.

@bilogic
Copy link

bilogic commented Nov 23, 2023

I gave a summary + response on #6546, let's continue there shall we?

code-asher added a commit that referenced this issue Nov 28, 2023
And fix the workspace bug.  It is caused by an issue with how some
global variables are being used asynchronously and is exacerbated by the
delay reading settings from the remote introduces.

1. The workspace is created and is marked as not initialized.
2. The configuration's change handler is triggered, and now
   initialization is complete.
3. The handler tries to set the global workspace variable to initialized
   but the workspace has not been set yet so we get an undefined error.
4. The workspace global is now set, but it is set to the old value with
   initialized still set to false.
5. Workspace is never marked as initialized until something else
   triggers the on change handler again.

Fixes #3061, and closes #6546.

My guess is this logic changed in one of the VS Code updates,
introducing this async bug but never getting caught probably because for
them the settings are always local thus minimal delay.
code-asher added a commit that referenced this issue Nov 28, 2023
And fix the workspace bug.  It is caused by an issue with how some
global variables are being used asynchronously and is exacerbated by the
delay reading settings from the remote introduces.

1. The workspace is created and is marked as not initialized.
2. The configuration's change handler is triggered, and now
   initialization is complete.
3. The handler tries to set the global workspace variable to initialized
   but the workspace has not been set yet so we get an undefined error.
4. The workspace global is now set, but it is set to the old value with
   initialized still set to false.
5. Workspace is never marked as initialized until something else
   triggers the on change handler again.

Fixes #3061, and closes #6546.

My guess is this logic changed in one of the VS Code updates,
introducing this async bug but never getting caught probably because for
them the settings are always local thus minimal delay.
@bilogic
Copy link

bilogic commented Jul 10, 2024

I was trying to build myself. Any idea what I should set for VERSION?

My basic workflow from scratch:

Update Code

  1. Clone repository

    git clone https://github.com/coder/code-server.git
  2. Update VS Code submodule to the new version

    cd code-server
    git submodule init
    git submodule update --remote
    cd lib/vscode
    git checkout 1.84.2
    cd ../..
  3. quilt push -f

    • If there are conflicts then resolve them
  4. quilt refresh

    • Back to step three until there are no more patches

❗ Usually checking out a tag (e.g git checkout 1.84.2), but the current release is based on git checkout 1a5daa3a

Set version

export VERSION='4.20.0-rc.1'

Install dependencies

yarn

Build code-server

yarn build
yarn build:vscode
KEEP_MODULES=1 yarn release

Modify version

npm version --prefix release "$VERSION"
tmp=$(mktemp)
jq ".codeServerVersion = \"$VERSION\"" release/lib/vscode/product.json > "$tmp" && mv "$tmp" release/lib/vscode/product.json
chmod 644 release/lib/vscode/product.json

Build release packages

yarn release:standalone
yarn test:integration
yarn package

Then, I deploy at https://coder.jupyter.b-data.ch/ (image R (base:test-devtools-docker)) and test some functionality manually.

See also https://coder.com/docs/code-server/latest/CONTRIBUTING

@benz0li can I ask if these are still your build steps? Have build times increased significantly since then?

@benz0li
Copy link
Contributor

benz0li commented Jul 10, 2024

@benz0li can I ask if these are still your build steps?

Yes, these are still my build steps.

Have build times increased significantly since then?

Yes, at least doubled, if not tripled.

@bilogic
Copy link

bilogic commented Jul 11, 2024

Thanks, I'm taking it up with vscode, hope they can do something about it. btw this might help apply patches to your insider builds.

while true; do
    quilt push -f
    code=$?
    echo code is $code

    if [ "$code" == 1 ]; then
        quilt refresh
    fi

    if [ "$code" == 2 ]; then
        break
    fi
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests