Grace period for inaccessible workspaces#50829
Grace period for inaccessible workspaces#50829ConradIrwin merged 3 commits intozed-industries:mainfrom
Conversation
Paths that are temporarily unavailable (e.g. external drives, network mounts) were being deleted from recent and session workspaces immediately. Recent workspaces now get a grace period based on their last-used timestamp.
|
Thanks for this! Instead of passing a bool to that function, should we just short-circuit and only check the old ones? I think the other caller should pass false to preserve existing behavior (not true) and it might be clearer if the bool wasn't there |
|
Hey @ConradIrwin, I have updated |
|
Thanks, that's much clearer! |
|
@ojpro congratulations on your first contribution to Zed! A great QoL improvement, at that! 💖 Have a great weekend! |
Closes zed-industries#49603 Release Notes: - Added a 7-day grace period to prevent recently used local workspaces from being deleted when their paths are temporarily unavailable. Session workspaces are always preserved on restart.
|
@ojpro I believe this PR is causing non-existent directories to appear in the recent project picker. Was that your intent? I think the correct behavior would be to allow a grace period before deleting the rows from Sqlite, but to still avoid showing inaccessible directories in the picker. Am I missing something there? If you get a chance, could you follow up and fix that? |
|
Hey @maxbrunsfeld Actually the intent is to only delete non-existence directories after a period (7 days by default), but if that project opened before that period end it should reset the grace period, and so on. The use case is, if I have a project A, but on an external drive | Network, I open a project B (on device), Zed remove the reference to that project A because the drive is not mounted during that session. |
|
I understand that we want to keep the directories in the database for seven days. But your change caused them to still show up in the recent projects picker (where they will then fail to open). I don't think that is a good behavior. /cc @ojpro |
|
Hey @maxbrunsfeld Okay. I will make it show the projects on the picker only if they exist. |
The behaviour actually seems weirder than that. I deleted a project, restarted Zed, and opened that project from the picker. Zed opened it as an unsaved file in my current workspace. Agree that non-existent projects should just be hidden. |
|
Hey @maxbrunsfeld , @ConradIrwin I have updated the logic to hide nonexisting workspaces from the picker if it within the grace period, instead of it being an empty file |
|
If you open a workspace, then close it and delete it from disk, restarting Zed will cause this error: And it seems like Zed does not restart cleanly -- previously open workspaces are not reopened. |
|
unable to produce the error Cap.2026-04-03.at.22.16.44.mp4 |
|
Hmm, I couldn't reproduce it again. Not sure if it's directly related then. |
Closes #49603
Release Notes: