Skip to content

Commit b3795b3

Browse files
committed
fix typing
1 parent 70ff60a commit b3795b3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

apps/sim/lib/logs/execution/logger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
230230
traceSpans?: TraceSpan[]
231231
workflowInput?: any
232232
isResume?: boolean // If true, merge with existing data instead of replacing
233+
level?: 'info' | 'error' // Optional override for log level (used in cost-only fallback)
233234
}): Promise<WorkflowExecutionLog> {
234235
const {
235236
executionId,
@@ -240,6 +241,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
240241
traceSpans,
241242
workflowInput,
242243
isResume,
244+
level: levelOverride,
243245
} = params
244246

245247
logger.debug(`Completing workflow execution ${executionId}`, { isResume })
@@ -256,6 +258,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
256258
}
257259

258260
// Determine if workflow failed by checking trace spans for errors
261+
// Use the override if provided (for cost-only fallback scenarios)
259262
const hasErrors = traceSpans?.some((span: any) => {
260263
const checkSpanForErrors = (s: any): boolean => {
261264
if (s.status === 'error') return true
@@ -267,7 +270,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
267270
return checkSpanForErrors(span)
268271
})
269272

270-
const level = hasErrors ? 'error' : 'info'
273+
const level = levelOverride ?? (hasErrors ? 'error' : 'info')
271274

272275
// Extract files from trace spans, final output, and workflow input
273276
const executionFiles = this.extractFilesFromExecution(traceSpans, finalOutput, workflowInput)

apps/sim/lib/logs/execution/logging-session.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface SessionCompleteParams {
2929
endedAt?: string
3030
totalDurationMs?: number
3131
finalOutput?: any
32-
traceSpans?: any[]
32+
traceSpans?: TraceSpan[]
3333
workflowInput?: any
3434
}
3535

@@ -336,6 +336,7 @@ export class LoggingSession {
336336
endedAt: params.endedAt,
337337
totalDurationMs: params.totalDurationMs,
338338
errorMessage: 'Trace spans too large to store',
339+
isError: false,
339340
})
340341
}
341342
}
@@ -349,6 +350,7 @@ export class LoggingSession {
349350
endedAt: params?.endedAt,
350351
totalDurationMs: params?.totalDurationMs,
351352
errorMessage: params?.error?.message || 'Execution failed, trace spans too large to store',
353+
isError: true,
352354
})
353355
}
354356
}
@@ -358,6 +360,7 @@ export class LoggingSession {
358360
endedAt?: string
359361
totalDurationMs?: number
360362
errorMessage: string
363+
isError: boolean
361364
}): Promise<void> {
362365
logger.warn(
363366
`[${this.requestId || 'unknown'}] Logging completion failed for execution ${this.executionId} - attempting cost-only fallback`
@@ -386,6 +389,7 @@ export class LoggingSession {
386389
finalOutput: { _fallback: true, error: params.errorMessage },
387390
traceSpans: [],
388391
isResume: this.isResume,
392+
level: params.isError ? 'error' : 'info',
389393
})
390394

391395
logger.info(

0 commit comments

Comments
 (0)