We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent4fd0312 commita665b5cCopy full SHA for a665b5c
agent/agentcontainers/api.go
@@ -661,7 +661,18 @@ func (api *API) processUpdatedContainersLocked(ctx context.Context, updated code
661
662
casedc.Container==nil:
663
if!api.devcontainerNames[dc.Name] {
664
-dc.Name=""
+// If this is a runtime-detected container, check if we
665
+// should remove it.
666
+// TODO(mafredri): Consider using afero.
667
+if_,err:=os.Stat(dc.WorkspaceFolder);errors.Is(err,os.ErrNotExist) {
668
+// If the workspace folder doesn't exist, we can assume
669
+// that the devcontainer is no longer valid and should be
670
+// removed.
671
+logger.Debug(ctx,"devcontainer workspace folder does not exist, removing devcontainer")
672
+delete(api.knownDevcontainers,dc.WorkspaceFolder)
673
+// TODO(mafredri): Delete the agent if it exists.
674
+continue
675
+}
676
}
677
dc.Status=codersdk.WorkspaceAgentDevcontainerStatusStopped
678
dc.Dirty=false