diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block/thinking-block.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block/thinking-block.tsx index ef92e1b43..3c95d83d4 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block/thinking-block.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block/thinking-block.tsx @@ -244,7 +244,9 @@ export function ThinkingBlock({ const hasContent = cleanContent.length > 0 const isThinkingDone = !isStreaming || hasFollowingContent || hasSpecialTags - const durationText = `${label} for ${formatDuration(Math.max(1000, duration))}` + // Round to nearest second (minimum 1s) to match original behavior + const roundedMs = Math.max(1000, Math.round(duration / 1000) * 1000) + const durationText = `${label} for ${formatDuration(roundedMs)}` const getStreamingLabel = (lbl: string) => { if (lbl === 'Thought') return 'Thinking' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx index 997d9e60e..f6ee0679a 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx @@ -850,7 +850,9 @@ const SubagentContentRenderer = memo(function SubagentContentRenderer({ ) const outerLabel = getSubagentCompletionLabel(toolCall.name) - const durationText = `${outerLabel} for ${formatDuration(Math.max(1000, duration))}` + // Round to nearest second (minimum 1s) to match original behavior + const roundedMs = Math.max(1000, Math.round(duration / 1000) * 1000) + const durationText = `${outerLabel} for ${formatDuration(roundedMs)}` const renderCollapsibleContent = () => ( <> diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx index 21b1c2834..c357d8c80 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx @@ -128,7 +128,7 @@ const BlockRow = memo(function BlockRow({ @@ -201,7 +201,7 @@ const IterationNodeRow = memo(function IterationNodeRow({ @@ -314,7 +314,7 @@ const SubflowNodeRow = memo(function SubflowNodeRow({ diff --git a/apps/sim/background/workspace-notification-delivery.ts b/apps/sim/background/workspace-notification-delivery.ts index c6a72f011..68bfa2fe8 100644 --- a/apps/sim/background/workspace-notification-delivery.ts +++ b/apps/sim/background/workspace-notification-delivery.ts @@ -297,7 +297,7 @@ async function deliverEmail( workflowName: payload.data.workflowName || 'Unknown Workflow', status: payload.data.status, trigger: payload.data.trigger, - duration: formatDuration(payload.data.totalDurationMs), + duration: formatDuration(payload.data.totalDurationMs, { precision: 1 }), cost: formatCost(payload.data.cost), logUrl, alertReason, @@ -310,7 +310,7 @@ async function deliverEmail( to: subscription.emailRecipients, subject, html, - text: `${subject}\n${alertReason ? `\nReason: ${alertReason}\n` : ''}\nWorkflow: ${payload.data.workflowName}\nStatus: ${statusText}\nTrigger: ${payload.data.trigger}\nDuration: ${formatDuration(payload.data.totalDurationMs)}\nCost: ${formatCost(payload.data.cost)}\n\nView Log: ${logUrl}${includedDataText}`, + text: `${subject}\n${alertReason ? `\nReason: ${alertReason}\n` : ''}\nWorkflow: ${payload.data.workflowName}\nStatus: ${statusText}\nTrigger: ${payload.data.trigger}\nDuration: ${formatDuration(payload.data.totalDurationMs, { precision: 1 })}\nCost: ${formatCost(payload.data.cost)}\n\nView Log: ${logUrl}${includedDataText}`, emailType: 'notifications', }) @@ -368,7 +368,10 @@ async function deliverSlack( fields: [ { type: 'mrkdwn', text: `*Status:*\n${payload.data.status}` }, { type: 'mrkdwn', text: `*Trigger:*\n${payload.data.trigger}` }, - { type: 'mrkdwn', text: `*Duration:*\n${formatDuration(payload.data.totalDurationMs)}` }, + { + type: 'mrkdwn', + text: `*Duration:*\n${formatDuration(payload.data.totalDurationMs, { precision: 1 })}`, + }, { type: 'mrkdwn', text: `*Cost:*\n${formatCost(payload.data.cost)}` }, ], }, diff --git a/apps/sim/components/ui/tool-call.tsx b/apps/sim/components/ui/tool-call.tsx index ade15ebe9..0d7d2ece2 100644 --- a/apps/sim/components/ui/tool-call.tsx +++ b/apps/sim/components/ui/tool-call.tsx @@ -275,7 +275,7 @@ export function ToolCallCompletion({ toolCall, isCompact = false }: ToolCallProp )} style={{ fontSize: '0.625rem' }} > - {formatDuration(toolCall.duration)} + {toolCall.duration ? formatDuration(toolCall.duration, { precision: 1 }) : ''} )}