Skip to content

Commit 889981a

Browse files
committed
fix(executor): mark a loop condition failure logged so the engine does not log it again
1 parent d424f34 commit 889981a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎apps/sim/executor/orchestrators/loop.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { storageServiceMockFns } from '@sim/testing/mocks/storage-service.mock'
88
import { uploadsMock } from '@sim/testing/mocks/uploads.mock'
99
import { beforeEach, describe, expect, it, vi } from 'vitest'
10-
import { classifyFailure } from '@/lib/core/errors/failure-log'
10+
import { classifyFailure, logFailureOnce } from '@/lib/core/errors/failure-log'
1111
import { clearLargeValueCacheForTests } from '@/lib/execution/payloads/cache'
1212
import { EDGE } from '@/executor/constants'
1313
import type { DAG, DAGNode } from '@/executor/dag/builder'
@@ -476,6 +476,8 @@ describe('loop continuation when the sandbox cannot evaluate', () => {
476476

477477
expect(classifyFailure(userError)).toBe('user')
478478
expect(classifyFailure(systemError)).toBe('internal')
479+
expect(logFailureOnce(createLogger('probe'), 'probe', userError)).toBeUndefined()
480+
expect(logFailureOnce(createLogger('probe'), 'probe', systemError)).toBeUndefined()
479481
})
480482

481483
it('keeps a resolved secret out of the persisted condition error', async () => {

‎apps/sim/executor/orchestrators/loop.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
classifyFailure,
55
inheritFailureMarks,
66
markFailureKind,
7+
markFailureLogged,
78
} from '@/lib/core/errors/failure-log'
89
import { generateRequestId } from '@/lib/core/utils/request'
910
import { executeInIsolatedVM } from '@/lib/execution/isolated-vm'
@@ -861,6 +862,9 @@ export class LoopOrchestrator {
861862
logFn('Failed to evaluate loop condition', { ...errorDiagnostic, isUserFailure })
862863
await this.addLoopErrorLog(ctx, loopId, loopType, persistedErrorMessage, {})
863864
scope.validationError = persistedErrorMessage
864-
throw inheritFailureMarks(new Error(persistedErrorMessage), cause)
865+
/** Logged above, so the engine does not log the same failure again as it propagates. */
866+
const failure = inheritFailureMarks(new Error(persistedErrorMessage), cause)
867+
markFailureLogged(failure)
868+
throw failure
865869
}
866870
}

0 commit comments

Comments
 (0)