File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ function injectScope(scope: "run" | "attempt" | "global"): string[] {
105
105
}
106
106
case "attempt" : {
107
107
if ( taskContext ?. ctx ) {
108
- return [ taskContext . ctx . attempt . id ] ;
108
+ return [ taskContext . ctx . run . id , taskContext . ctx . attempt . number . toString ( ) ] ;
109
109
}
110
110
break ;
111
111
}
@@ -125,3 +125,17 @@ async function generateIdempotencyKey(keyMaterial: string[]) {
125
125
. map ( ( byte ) => byte . toString ( 16 ) . padStart ( 2 , "0" ) )
126
126
. join ( "" ) ;
127
127
}
128
+
129
+ type AttemptKeyMaterial = {
130
+ run : {
131
+ id : string ;
132
+ } ;
133
+ attempt : {
134
+ number : number ;
135
+ } ;
136
+ } ;
137
+
138
+ /** Creates a unique key for each attempt. */
139
+ export function attemptKey ( ctx : AttemptKeyMaterial ) : string {
140
+ return `${ ctx . run . id } -${ ctx . attempt . number } ` ;
141
+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
} from "../errors.js" ;
13
13
import {
14
14
accessoryAttributes ,
15
+ attemptKey ,
15
16
flattenAttributes ,
16
17
lifecycleHooks ,
17
18
runMetadata ,
@@ -235,7 +236,7 @@ export class TaskExecutor {
235
236
const [ exportError , finalOutput ] = await tryCatch (
236
237
conditionallyExportPacket (
237
238
stringifiedOutput ,
238
- `${ execution . attempt . id } /output` ,
239
+ `${ attemptKey ( ctx ) } /output` ,
239
240
this . _tracer
240
241
)
241
242
) ;
You can’t perform that action at this time.
0 commit comments