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[] {
105105 }
106106 case "attempt" : {
107107 if ( taskContext ?. ctx ) {
108- return [ taskContext . ctx . attempt . id ] ;
108+ return [ taskContext . ctx . run . id , taskContext . ctx . attempt . number . toString ( ) ] ;
109109 }
110110 break ;
111111 }
@@ -125,3 +125,17 @@ async function generateIdempotencyKey(keyMaterial: string[]) {
125125 . map ( ( byte ) => byte . toString ( 16 ) . padStart ( 2 , "0" ) )
126126 . join ( "" ) ;
127127}
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 {
1212} from "../errors.js" ;
1313import {
1414 accessoryAttributes ,
15+ attemptKey ,
1516 flattenAttributes ,
1617 lifecycleHooks ,
1718 runMetadata ,
@@ -235,7 +236,7 @@ export class TaskExecutor {
235236 const [ exportError , finalOutput ] = await tryCatch (
236237 conditionallyExportPacket (
237238 stringifiedOutput ,
238- `${ execution . attempt . id } /output` ,
239+ `${ attemptKey ( ctx ) } /output` ,
239240 this . _tracer
240241 )
241242 ) ;
You can’t perform that action at this time.
0 commit comments