Open
Description
In coder/coder#18465 we duplicated a code path from provisionerdserver into wsbuilder.
Original logic: https://github.com/coder/coder/blob/f44969b6898bd32cd29193bea910693800bbda87/coderd/provisionerdserver/provisionerdserver.go#L2007-L2077
Duplicated logic:
-
mark workspace as deleted in case of orphan: https://github.com/coder/coder/blob/f44969b6898bd32cd29193bea910693800bbda87/coderd/wsbuilder/wsbuilder.go#L462-L504
-
create audit log in case of orphan: https://github.com/coder/coder/blob/f44969b6898bd32cd29193bea910693800bbda87/coderd/workspacebuilds.go#L423-L458
This could be extracted out into some kind of helper function to reduce duplication.