Skip to content

Store state on remote instead of browser #4212

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
abhay-ranawat opened this issue Sep 20, 2021 · 19 comments
Open

Store state on remote instead of browser #4212

abhay-ranawat opened this issue Sep 20, 2021 · 19 comments
Labels
enhancement Some improvement that isn't a feature needs-investigation This issue needs to be further investigated
Milestone

Comments

@abhay-ranawat
Copy link

abhay-ranawat commented Sep 20, 2021

Edit by @code-asher: Storing the state in the browser has (at least) the two following problems:

  1. If you switch to another browser you have to open and configure everything all over again (what this issue was originally about).
  2. It is impossible to seed the initial state like you could in native VS Code by writing to the JSON state file.

Original issue content follows.

OS/Web Information

  • Web Browser: Chrome v91
  • Local OS: Windows 10
  • Remote OS: Ubuntu 20.04
  • Remote Architecture: Debian
  • code-server --version: 3.12.0

Steps to Reproduce

  1. Open a new code server instance in browser and make some changes (eg : hide remote host).
  2. Open the same instance in incognito tab.
  3. The changed made above will not be reflected, and you have to make those changes again.

Expected

Till v3.11 the state of code-server was maintained across browsers.

Actual

The state is saved local storage instead of server and hence the changes does not reflect on browser changes.

Notes

scope === StorageScope.GLOBAL ? 'global' : this.payload.id; it is in workbench.web.api.js.map
Perhaps it's related to where the state is saved?
From discussion : #4185

@jsjoeio jsjoeio added the needs-investigation This issue needs to be further investigated label Sep 21, 2021
@jsjoeio jsjoeio added this to the On Deck milestone Sep 21, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Sep 21, 2021

Thanks for opening this up @abhay-ranawat! We'll have to investigate

@benz0li
Copy link
Contributor

benz0li commented Sep 24, 2021

I have the same issue.

It would be great to have this resolved with v3.12.1.

@jsjoeio
Copy link
Contributor

jsjoeio commented Sep 24, 2021

It would be great to have this resolved with v3.12.1.

That's unlikely to happen given our bandwidth (just setting expectations) but at least we know multiple folks are experiencing this issue.

@abhay-ranawat
Copy link
Author

abhay-ranawat commented Sep 24, 2021

It would be great to have this resolved with v3.12.1.

That's unlikely to happen given our bandwidth (just setting expectations) but at least we know multiple folks are experiencing this issue.

Given the changes made in code, everyone should face it (AFAIK) only few might be noticing it.

@benz0li
Copy link
Contributor

benz0li commented Oct 6, 2021

Agreed. I noticed it because I regularly delete all cookies and site data that the browser stores. I don't mind setting an exception for the domains on which code-server is deployed, though.

It doesn't matter whether the state is stored in ~/.local/share/code-server/User/state or the browser 's site data - but it should be documented, which is the case.
👉 In order to reset the state, one has to either delete ~/.local/share/code-server/User/state or clear the browser's site data.

ℹ️ I had to delete folder ~/.local/share/code-server/User/state after I moved from debian:buster to debian:bullseye, because e.g. the new Python version was not displayed correctly in v3.10.2.

@stale
Copy link

stale bot commented Apr 4, 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.

@benz0li
Copy link
Contributor

benz0li commented Apr 4, 2022

As for stale bot see https://drewdevault.com/2021/10/26/stalebot.html: This is a terrible, horrible, no good, very bad idea.

@stale stale bot removed the stale label Apr 4, 2022
@code-asher
Copy link
Member

https://drewdevault.com/2021/10/26/stalebot.html

That was a great read. In the past we would periodically run through old issues and close out ones that no longer were applicable (this is because things can change a lot when we update Code versions) and the stale bot moves that burden off us to those who opened the issue. We could just leave them alone but we felt like keeping issues up to date was part of good repository maintenance. Maybe there is a better solution, like labeling issues that are on the Code side with something like upstream and then adding stale or revalidate or something to those when we update Code?

For the browser state I did look into moving it back to the remote file system but it looked non-trivial so I abandoned that effort since we generally try to avoid patches that deviate too aggressively from mainline.

There might be a clean way to do it with a bit more investigation though or maybe upstream would be receptive of a change to make this behavior configurable.

@code-asher code-asher changed the title Maintain state across browsers Maintain state across browsers/sessions Jun 21, 2023
benz0li referenced this issue Nov 21, 2023
The main goal of this patch was to make user settings stored on disk
instead of in the browser, but this stopped working some time ago.  Not
only that but it is causing a bug where a workspace will not fully open.

A secondary goal was to fix the Vim extension but the extension appears
to work just fine without this change now (both the server and browser
versions).

This patch is not useful anymore anyway because there are remote-level
settings that *do* get stored on disk and can be used instead of
user-level settings when necessary.

Fixes #3061, and possibly #6153.
@code-asher code-asher changed the title Maintain state across browsers/sessions Store state on remote instead of browser Dec 29, 2023
@code-asher
Copy link
Member

For now i believe we are going to leave this as-is. If someone wants to dive in and figure out how to move the state to the remote like we do with settings, a PR would be much welcome.

@code-asher code-asher closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2024
@KaKi87
Copy link

KaKi87 commented Jul 13, 2024

There might be a clean way to do it

How about a plugin ?

@code-asher
Copy link
Member

How about a plugin?

Maybe! Something similar to settings sync, where it syncs the state to and from the disk maybe?

@KaKi87
Copy link

KaKi87 commented Jul 15, 2024

Yeah. Maybe more code-server features could be implemented as plugins and preinstalled for easy activation.

@code-asher
Copy link
Member

I like that idea.

@coder-labeler coder-labeler bot added the enhancement Some improvement that isn't a feature label Jul 26, 2024
@code-asher
Copy link
Member

Went ahead and re-opened, still no plans but I do think it would be nice especially since native settings sync does not work with code-server.

@fulllagado1
Copy link

fulllagado1 commented Aug 1, 2024

What is being willed is to visual code work as Jupyter Lab does with workspaces, totally portable. In Jupyter Lab, if I run a python file at home computer and open Jupyter interface on work computer, I get the same screen. If I do in code server, I get a new screen and if I need to rerun the python file (mainly if it is a server app), I need to open a new terminal (original one became a ghost, vanished) find its pid, kill it and run again. If I open a next server, it even vanishes from forwarded ports panel, inducing to open a new terminal, start next server again, with a new port (the previous one is used, by a ghost process). Jupyter Lab guys figured out those problems in the beginning of Jupyter notebook classic as reporting already running terminals and made somehow web development easier done in multiple machines than visual code server.

@benz0li
Copy link
Contributor

benz0li commented Aug 1, 2024

@fulllagado1 For your use case, use a terminal multiplexer such as screen or tmux.

@code-asher
Copy link
Member

Seems the upstream issue for this was closed right away but maybe with enough upvotes we can get it changed without having to patch it here: microsoft/vscode#210775

@KaKi87
Copy link

KaKi87 commented Aug 3, 2024

maybe with enough upvotes we can get it changed without having to patch it here

In a century, maybe.

@mgerasimchuk
Copy link

Faced the same needs, and spent 2 days trying to find settings / "hack" the global state / load profiles during the first run and through the URL

It would be really great to have this possibility for store state on the server side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Some improvement that isn't a feature needs-investigation This issue needs to be further investigated
Projects
None yet
Development

No branches or pull requests

7 participants