@@ -138,6 +138,8 @@ export class LoggingSession {
138138 private completionAttemptFailed = false
139139 private pendingProgressWrites = new Set < Promise < void > > ( )
140140 private postExecutionPromise : Promise < void > | null = null
141+ /** Guards against double-counting ExecutionStarted across start/fallback paths */
142+ private startMetricEmitted = false
141143 /** Guards against double-counting ExecutionCompleted across completion paths */
142144 private completionMetricEmitted = false
143145
@@ -221,6 +223,12 @@ export class LoggingSession {
221223 }
222224 }
223225
226+ private emitExecutionStartedMetric ( ) : void {
227+ if ( this . startMetricEmitted ) return
228+ this . startMetricEmitted = true
229+ workflowMetrics . recordExecutionStarted ( { trigger : this . triggerType } )
230+ }
231+
224232 private emitExecutionCompletedMetric ( status : WorkflowExecutionStatus , durationMs ?: number ) : void {
225233 if ( this . completionMetricEmitted ) return
226234 this . completionMetricEmitted = true
@@ -334,7 +342,7 @@ export class LoggingSession {
334342 workflowState : this . workflowState ,
335343 deploymentVersionId,
336344 } )
337- workflowMetrics . recordExecutionStarted ( { trigger : this . triggerType } )
345+ this . emitExecutionStartedMetric ( )
338346 } else {
339347 // Resume: no cost reload needed. Billing reconciles from the usage_log
340348 // ledger (pre-pause rows already exist) plus the live cost summary.
@@ -793,7 +801,7 @@ export class LoggingSession {
793801 workflowState : this . workflowState ,
794802 deploymentVersionId,
795803 } )
796- workflowMetrics . recordExecutionStarted ( { trigger : this . triggerType } )
804+ this . emitExecutionStartedMetric ( )
797805
798806 if ( this . requestId ) {
799807 logger . debug (
0 commit comments