diff --git a/apps/sim/lib/logs/execution/logging-session.test.ts b/apps/sim/lib/logs/execution/logging-session.test.ts index a44bc5e72d..dfc2a306d2 100644 --- a/apps/sim/lib/logs/execution/logging-session.test.ts +++ b/apps/sim/lib/logs/execution/logging-session.test.ts @@ -391,10 +391,12 @@ describe('LoggingSession completion retries', () => { await session.onBlockComplete('block-2', 'Transform', 'function', { endedAt: '2025-01-01T00:00:01.000Z', - output: { value: true }, - cost: { total: 1, input: 1, output: 0 }, - tokens: { input: 1, output: 0, total: 1 }, - model: 'test-model', + output: { + value: true, + cost: { total: 1, input: 1, output: 0 }, + tokens: { input: 1, output: 0, total: 1 }, + model: 'test-model', + }, }) const completionPromise = session.safeComplete({ finalOutput: { ok: true } }) diff --git a/apps/sim/lib/logs/execution/logging-session.ts b/apps/sim/lib/logs/execution/logging-session.ts index 7fb72bc1d7..3b0a20bd64 100644 --- a/apps/sim/lib/logs/execution/logging-session.ts +++ b/apps/sim/lib/logs/execution/logging-session.ts @@ -294,11 +294,16 @@ export class LoggingSession { }) ) - if (!output?.cost || typeof output.cost.total !== 'number' || output.cost.total <= 0) { + const blockOutput = output?.output + if ( + !blockOutput?.cost || + typeof blockOutput.cost.total !== 'number' || + blockOutput.cost.total <= 0 + ) { return } - const { cost, tokens, model } = output + const { cost, tokens, model } = blockOutput this.accumulatedCost.total += cost.total || 0 this.accumulatedCost.input += cost.input || 0