File tree Expand file tree Collapse file tree
apps/supervisor/src/workloadServer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ area : supervisor
3+ type : fix
4+ ---
5+
6+ Keep older workloads working when checkpoints are produced by the compute path
Original file line number Diff line number Diff line change @@ -43,6 +43,18 @@ const WorkloadActionParams = z.object({
4343 snapshotFriendlyId : z . string ( ) ,
4444} ) ;
4545
46+ // Workloads bundled into customer task images before CLI v4.4.4 use a strict
47+ // zod enum for checkpoint type that only allows DOCKER and KUBERNETES. The
48+ // workload never reads this field - it only validates the response shape - so
49+ // rewriting it to a known value keeps older runners working without affecting
50+ // the value stored in the database or seen by internal services.
51+ function legacifyCheckpointType < T extends { checkpoint ?: { type : string } | null } > ( item : T ) : T {
52+ if ( item . checkpoint ?. type === "COMPUTE" ) {
53+ return { ...item , checkpoint : { ...item . checkpoint , type : "KUBERNETES" } } as T ;
54+ }
55+ return item ;
56+ }
57+
4658type WorkloadServerEvents = {
4759 runConnected : [
4860 {
@@ -384,7 +396,9 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
384396 return ;
385397 }
386398
387- reply . json ( sinceSnapshotResponse . data satisfies WorkloadRunSnapshotsSinceResponseBody ) ;
399+ reply . json ( {
400+ snapshots : sinceSnapshotResponse . data . snapshots . map ( legacifyCheckpointType ) ,
401+ } satisfies WorkloadRunSnapshotsSinceResponseBody ) ;
388402 } ,
389403 }
390404 )
@@ -409,7 +423,9 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
409423 return ;
410424 }
411425
412- reply . json ( dequeueResponse . data satisfies WorkloadDequeueFromVersionResponseBody ) ;
426+ reply . json (
427+ dequeueResponse . data . map ( legacifyCheckpointType ) satisfies WorkloadDequeueFromVersionResponseBody
428+ ) ;
413429 } ,
414430 } ) ;
415431
You can’t perform that action at this time.
0 commit comments