Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(logs): address PR review — redact workflowInput, improve fallback…
… heuristic, add isPending guard
  • Loading branch information
waleedlatif1 committed Apr 15, 2026
commit ccf975146e82b85cc33eb8d696a14bc01ee5884a
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ interface LogDetailsProps {
hasPrev?: boolean
/** Callback to retry a failed execution */
onRetryExecution?: () => void
/** Whether a retry is currently in progress */
isRetryPending?: boolean
}

/**
Expand All @@ -283,6 +285,7 @@ export const LogDetails = memo(function LogDetails({
hasNext = false,
hasPrev = false,
onRetryExecution,
isRetryPending = false,
}: LogDetailsProps) {
const [isExecutionSnapshotOpen, setIsExecutionSnapshotOpen] = useState(false)
const scrollAreaRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -399,6 +402,7 @@ export const LogDetails = memo(function LogDetails({
variant='ghost'
className='!p-1'
onClick={() => onRetryExecution?.()}
disabled={isRetryPending}
aria-label='Retry execution'
>
<Redo className='h-[14px] w-[14px]' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface LogRowContextMenuProps {
onClearAllFilters: () => void
onCancelExecution: () => void
onRetryExecution: () => void
isRetryPending?: boolean
isFilteredByThisWorkflow: boolean
hasActiveFilters: boolean
}
Expand All @@ -45,6 +46,7 @@ export const LogRowContextMenu = memo(function LogRowContextMenu({
onClearAllFilters,
onCancelExecution,
onRetryExecution,
isRetryPending = false,
isFilteredByThisWorkflow,
hasActiveFilters,
}: LogRowContextMenuProps) {
Expand Down Expand Up @@ -78,9 +80,9 @@ export const LogRowContextMenu = memo(function LogRowContextMenu({
>
{isRetryable && (
<>
<DropdownMenuItem onSelect={onRetryExecution}>
<DropdownMenuItem onSelect={onRetryExecution} disabled={isRetryPending}>
<Redo />
Retry
{isRetryPending ? 'Retrying...' : 'Retry'}
</DropdownMenuItem>
<DropdownMenuSeparator />
</>
Expand Down
3 changes: 3 additions & 0 deletions apps/sim/app/workspace/[workspaceId]/logs/logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ export default function Logs() {
hasNext={selectedLogIndex < sortedLogs.length - 1}
hasPrev={selectedLogIndex > 0}
onRetryExecution={handleRetrySidebarExecution}
isRetryPending={retryExecution.isPending}
/>
),
[
Expand All @@ -830,6 +831,7 @@ export default function Logs() {
handleNavigateNext,
handleNavigatePrev,
handleRetrySidebarExecution,
retryExecution.isPending,
selectedLogIndex,
sortedLogs.length,
]
Expand Down Expand Up @@ -1231,6 +1233,7 @@ export default function Logs() {
onOpenPreview={handleOpenPreview}
onCancelExecution={handleCancelExecution}
onRetryExecution={handleRetryExecution}
isRetryPending={retryExecution.isPending}
onToggleWorkflowFilter={handleToggleWorkflowFilter}
onClearAllFilters={handleClearAllFilters}
isFilteredByThisWorkflow={isFilteredByThisWorkflow}
Expand Down
11 changes: 9 additions & 2 deletions apps/sim/app/workspace/[workspaceId]/logs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,19 @@ export function extractRetryInput(log: WorkflowLog): unknown | undefined {
}

const executionState = execData.executionState as
| { blockStates?: Record<string, { output?: unknown }> }
| {
blockStates?: Record<
string,
{ output?: unknown; executed?: boolean; executionTime?: number }
>
}
| undefined
if (!executionState?.blockStates) return undefined

// Starter/trigger blocks are pre-populated with executed: false and executionTime: 0,
// which distinguishes them from blocks that actually ran during execution.
for (const state of Object.values(executionState.blockStates)) {
if (state.output && typeof state.output === 'object' && 'input' in state.output) {
if (state.executed === false && state.executionTime === 0 && state.output != null) {
return state.output
}
Comment thread
waleedlatif1 marked this conversation as resolved.
}
Expand Down
5 changes: 4 additions & 1 deletion apps/sim/lib/logs/execution/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ export class ExecutionLogger implements IExecutionLoggerService {
? Math.max(0, Math.round(rawDurationMs))
: 0

const redactedWorkflowInput =
workflowInput !== undefined ? redactApiKeys(filterForDisplay(workflowInput)) : undefined
Comment thread
waleedlatif1 marked this conversation as resolved.
Outdated

const completedExecutionData = this.buildCompletedExecutionData({
existingExecutionData,
traceSpans: redactedTraceSpans,
Expand All @@ -380,7 +383,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
completionFailure,
executionCost,
executionState,
workflowInput,
workflowInput: redactedWorkflowInput,
})

const [updatedLog] = await db
Expand Down
Loading