@@ -44,6 +44,7 @@ export async function handleTaskFailed({
44
44
job,
45
45
maxRetries,
46
46
output,
47
+ parent,
47
48
req,
48
49
retriesConfig,
49
50
runnerOutput,
@@ -60,6 +61,7 @@ export async function handleTaskFailed({
60
61
job : BaseJob
61
62
maxRetries : number
62
63
output : object
64
+ parent ?: TaskParent
63
65
req : PayloadRequest
64
66
retriesConfig : number | RetryConfig
65
67
runnerOutput ?: TaskHandlerResult < string >
@@ -93,6 +95,7 @@ export async function handleTaskFailed({
93
95
executedAt : executedAt . toISOString ( ) ,
94
96
input,
95
97
output,
98
+ parent : req ?. payload ?. config ?. jobs ?. addParentToTaskLog ? parent : undefined ,
96
99
state : 'failed' ,
97
100
taskID,
98
101
taskSlug,
@@ -142,13 +145,19 @@ export async function handleTaskFailed({
142
145
}
143
146
}
144
147
148
+ export type TaskParent = {
149
+ taskID : string
150
+ taskSlug : string
151
+ }
152
+
145
153
export const getRunTaskFunction = < TIsInline extends boolean > (
146
154
state : RunTaskFunctionState ,
147
155
job : BaseJob ,
148
156
workflowConfig : WorkflowConfig < string > ,
149
157
req : PayloadRequest ,
150
158
isInline : TIsInline ,
151
159
updateJob : UpdateJobFunction ,
160
+ parent ?: TaskParent ,
152
161
) : TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions => {
153
162
const runTask : < TTaskSlug extends string > (
154
163
taskSlug : TTaskSlug ,
@@ -240,6 +249,7 @@ export const getRunTaskFunction = <TIsInline extends boolean>(
240
249
completedAt : new Date ( ) . toISOString ( ) ,
241
250
error : errorMessage ,
242
251
executedAt : executedAt . toISOString ( ) ,
252
+ parent : req ?. payload ?. config ?. jobs ?. addParentToTaskLog ? parent : undefined ,
243
253
state : 'failed' ,
244
254
taskID,
245
255
taskSlug,
@@ -269,9 +279,17 @@ export const getRunTaskFunction = <TIsInline extends boolean>(
269
279
270
280
try {
271
281
const runnerOutput = await runner ( {
282
+ inlineTask : getRunTaskFunction ( state , job , workflowConfig , req , true , updateJob , {
283
+ taskID,
284
+ taskSlug,
285
+ } ) ,
272
286
input,
273
287
job : job as unknown as RunningJob < WorkflowTypes > , // TODO: Type this better
274
288
req,
289
+ tasks : getRunTaskFunction ( state , job , workflowConfig , req , false , updateJob , {
290
+ taskID,
291
+ taskSlug,
292
+ } ) ,
275
293
} )
276
294
277
295
if ( runnerOutput . state === 'failed' ) {
@@ -281,6 +299,7 @@ export const getRunTaskFunction = <TIsInline extends boolean>(
281
299
job,
282
300
maxRetries,
283
301
output,
302
+ parent,
284
303
req,
285
304
retriesConfig : finalRetriesConfig ,
286
305
runnerOutput,
@@ -303,6 +322,7 @@ export const getRunTaskFunction = <TIsInline extends boolean>(
303
322
job,
304
323
maxRetries,
305
324
output,
325
+ parent,
306
326
req,
307
327
retriesConfig : finalRetriesConfig ,
308
328
state,
@@ -327,6 +347,7 @@ export const getRunTaskFunction = <TIsInline extends boolean>(
327
347
executedAt : executedAt . toISOString ( ) ,
328
348
input,
329
349
output,
350
+ parent : req ?. payload ?. config ?. jobs ?. addParentToTaskLog ? parent : undefined ,
330
351
state : 'succeeded' ,
331
352
taskID,
332
353
taskSlug,
0 commit comments