@@ -1072,6 +1072,17 @@ func (api *API) putWorkspaceAutostart(rw http.ResponseWriter, r *http.Request) {
1072
1072
return
1073
1073
}
1074
1074
1075
+ // Autostart configuration is not supported for prebuilt workspaces.
1076
+ // Prebuild lifecycle is managed by the reconciliation loop, with scheduling behavior
1077
+ // defined per preset at the template level, not per workspace.
1078
+ if workspace .IsPrebuild () {
1079
+ httpapi .Write (ctx , rw , http .StatusConflict , codersdk.Response {
1080
+ Message : "Autostart is not supported for prebuilt workspaces" ,
1081
+ Detail : "Prebuilt workspace scheduling is configured per preset at the template level. Workspace-level overrides are not supported." ,
1082
+ })
1083
+ return
1084
+ }
1085
+
1075
1086
dbSched , err := validWorkspaceSchedule (req .Schedule )
1076
1087
if err != nil {
1077
1088
httpapi .Write (ctx , rw , http .StatusBadRequest , codersdk.Response {
@@ -1156,6 +1167,17 @@ func (api *API) putWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
1156
1167
return
1157
1168
}
1158
1169
1170
+ // TTL updates are not supported for prebuilt workspaces.
1171
+ // Prebuild lifecycle is managed by the reconciliation loop, with TTL behavior
1172
+ // defined per preset at the template level, not per workspace.
1173
+ if workspace .IsPrebuild () {
1174
+ httpapi .Write (ctx , rw , http .StatusConflict , codersdk.Response {
1175
+ Message : "TTL updates are not supported for prebuilt workspaces" ,
1176
+ Detail : "Prebuilt workspace TTL is configured per preset at the template level. Workspace-level overrides are not supported." ,
1177
+ })
1178
+ return
1179
+ }
1180
+
1159
1181
var dbTTL sql.NullInt64
1160
1182
1161
1183
err := api .Database .InTx (func (s database.Store ) error {
@@ -1272,6 +1294,16 @@ func (api *API) putWorkspaceDormant(rw http.ResponseWriter, r *http.Request) {
1272
1294
return
1273
1295
}
1274
1296
1297
+ // Dormancy configuration is not supported for prebuilt workspaces.
1298
+ // Prebuilds are managed by the reconciliation loop and are not subject to dormancy.
1299
+ if oldWorkspace .IsPrebuild () {
1300
+ httpapi .Write (ctx , rw , http .StatusConflict , codersdk.Response {
1301
+ Message : "Dormancy configuration is not supported for prebuilt workspaces" ,
1302
+ Detail : "Prebuilt workspaces are not subject to dormancy. Dormancy behavior is only applicable to regular workspaces" ,
1303
+ })
1304
+ return
1305
+ }
1306
+
1275
1307
// If the workspace is already in the desired state do nothing!
1276
1308
if oldWorkspace .DormantAt .Valid == req .Dormant {
1277
1309
rw .WriteHeader (http .StatusNotModified )
@@ -1416,6 +1448,17 @@ func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
1416
1448
return
1417
1449
}
1418
1450
1451
+ // Deadline extensions are not supported for prebuilt workspaces.
1452
+ // Prebuilds are managed by the reconciliation loop and must always have
1453
+ // Deadline and MaxDeadline unset.
1454
+ if workspace .IsPrebuild () {
1455
+ httpapi .Write (ctx , rw , http .StatusConflict , codersdk.Response {
1456
+ Message : "Deadline extension is not supported for prebuilt workspaces" ,
1457
+ Detail : "Prebuilt workspaces do not support user deadline modifications. Deadline extension is only applicable to regular workspaces" ,
1458
+ })
1459
+ return
1460
+ }
1461
+
1419
1462
code := http .StatusOK
1420
1463
resp := codersdk.Response {}
1421
1464
0 commit comments