diff --git a/apps/sim/executor/handlers/condition/condition-handler.ts b/apps/sim/executor/handlers/condition/condition-handler.ts index 2954b06d8..6039562f6 100644 --- a/apps/sim/executor/handlers/condition/condition-handler.ts +++ b/apps/sim/executor/handlers/condition/condition-handler.ts @@ -85,7 +85,11 @@ export class ConditionBlockHandler implements BlockHandler { const sourceBlockId = ctx.workflow?.connections.find((conn) => conn.target === block.id)?.source const evalContext = this.buildEvaluationContext(ctx, sourceBlockId) - const sourceOutput = sourceBlockId ? ctx.blockStates.get(sourceBlockId)?.output : null + const rawSourceOutput = sourceBlockId ? ctx.blockStates.get(sourceBlockId)?.output : null + + // Filter out _pauseMetadata from source output to prevent the engine from + // thinking this block is pausing (it was already resumed by the HITL block) + const sourceOutput = this.filterPauseMetadata(rawSourceOutput) const outgoingConnections = ctx.workflow?.connections.filter((conn) => conn.source === block.id) @@ -125,6 +129,14 @@ export class ConditionBlockHandler implements BlockHandler { } } + private filterPauseMetadata(output: any): any { + if (!output || typeof output !== 'object') { + return output + } + const { _pauseMetadata, ...rest } = output + return rest + } + private parseConditions(input: any): Array<{ id: string; title: string; value: string }> { try { const conditions = Array.isArray(input) ? input : JSON.parse(input || '[]') diff --git a/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts b/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts index 936f7cd29..fe936920e 100644 --- a/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts +++ b/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts @@ -567,6 +567,32 @@ export class PauseResumeManager { stateCopy.blockStates[stateBlockKey] = pauseBlockState + // Update the block log entry with the merged output so logs show the submission data + if (Array.isArray(stateCopy.blockLogs)) { + const blockLogIndex = stateCopy.blockLogs.findIndex( + (log: { blockId: string }) => + log.blockId === stateBlockKey || + log.blockId === pauseBlockId || + log.blockId === contextId + ) + if (blockLogIndex !== -1) { + // Filter output for logging (exclude internal fields and response) + const filteredOutput: Record = {} + for (const [key, value] of Object.entries(mergedOutput)) { + if (key.startsWith('_')) continue + if (key === 'response') continue + filteredOutput[key] = value + } + stateCopy.blockLogs[blockLogIndex] = { + ...stateCopy.blockLogs[blockLogIndex], + blockId: stateBlockKey, + output: filteredOutput, + durationMs: pauseDurationMs, + endedAt: new Date().toISOString(), + } + } + } + if (Array.isArray(stateCopy.executedBlocks)) { const filtered = stateCopy.executedBlocks.filter( (id: string) => id !== pauseBlockId && id !== contextId