vscode: Codespaces: better handle invalid workspaces when opening

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: Insiders
  • OS Version: Mac OS

Repro Steps:

  1. Create a codespace
  2. Open a subdirectory using File -> Open..., which will cause future connections to connect to that folder by default
  3. Delete/rename the subdirectory so that it doesn’t exist anymore
  4. Disconnect and try to reconnect to the codespace

Expected: The connection succeeds, ideally to the repo root as the fallback, or instead by recreating the missing folder and connecting to the empty folder.

Actual: Connection fails

DeletedFolder

Issue reported to codespaces: https://github.com/microsoft/vssaas-planning/issues/5354

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@jkeech @GideonCheruiyot can I get some UI thoughts on this flow:

Desktop remote-desktop-recording

Web remote-web-recording

Both folder and workspace file (*.code-workspace) are validated right on startup. The user can still cancel though, but I think that is fair.

//cc @misolori

Again: how much sense does it make that a user is entering the previously entered folder when opening the direct codespace URL? should that change rather?

Just to clarify: the feature where Codespaces remembers the last folder is not the only way this can happen. We’ve seen reports from users where they’ve deleted/renamed the repo directory as well, so always opening that one can have a similar problem. The product team does not want to change the behavior of Codespaces remembering the last folder/workspace you used either, since most people want to pick up right where they left off.

  • showing a modal dialog could be helpful to inform the user in a nice way and offering options to change the workspace or stay in the workspace
  • the explorer could indicate more pleasantly that the workspace is invalid and maybe offer actions similar to the dialog

I really like this idea. Could you open the folder picker from File: Open.. with a message to the user saying that the requested folder/workspace doesn’t exist and ask them to pick from one of the places that does exist? It seems like this solution would work for both web and desktop as well.

If we did this, we can always start the VS Code server and complete the connection from the resolver side, and then internally VS Code can guide the user down the path of picking a good folder if the requested one is invalid. Once the user picks, the window would likely reload into that folder.

Looks like I missed a fix to recreate a deleted workspace folder which is why I couldn’t repro by deleting the workspace folder. Verified the fix in both Web and Desktop by trying to delete and connect to non-workspace folders. Thanks! @bpasero.

It shipped to insiders, I just verified it on web and it seems to work. It should work equally well on desktop.

yeah I can roll up the status, but not sure if want to do anything while start up itself

@bpasero I take back this and I do not think following call can return the status

https://github.com/microsoft/vscode/blob/31152fd902cf50ea37c2667ed4c6d57000c771d0/src/vs/workbench/electron-sandbox/shared.desktop.main.ts#L318

because, initialize will not wait always for the workspace folders to be resolved especially when these folders are remote. Otherwise this will cause deadlock.

If you would like to validate, I would recommend to resolve the workspace folders outside and take appropriate action.