feat(logs): add retry from context menu and detail sidebar for failed runs#4181
feat(logs): add retry from context menu and detail sidebar for failed runs#4181waleedlatif1 wants to merge 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds a Persists Reviewed by Cursor Bugbot for commit 2591102. Configure here. |
Greptile SummaryThis PR adds a retry action for failed workflow runs via the log row context menu and the detail sidebar, persisting
Confidence Score: 4/5Safe to merge after addressing the unredacted workflowInput storage — the UI and hook changes are clean and the previous review issues are resolved. One P1 security finding: workflowInput bypasses redactApiKeys() while traceSpans and finalOutput are both redacted. All other findings are P2 or lower. Prior review concerns (fallback heuristic, isPending guard) are confirmed resolved. apps/sim/lib/logs/execution/logger.ts — unredacted workflowInput persistence
|
| Filename | Overview |
|---|---|
| apps/sim/lib/logs/execution/logger.ts | Persists workflowInput to the database without passing it through redactApiKeys(), while traceSpans and finalOutput are redacted. Also uses any for workflowInput parameter type. |
| apps/sim/hooks/queries/logs.ts | Adds useRetryExecution mutation that fires POST /execute with stream: true, reads one chunk, then cancels to trigger server-side execution without blocking; cache invalidation and isPending guard are correct. |
| apps/sim/app/workspace/[workspaceId]/logs/utils.ts | Adds extractRetryInput with correct fallback heuristic (executed === false && executionTime === 0) for old logs; logic is clean and the previous reviewer concerns are addressed. |
| apps/sim/app/workspace/[workspaceId]/logs/logs.tsx | Wires retry logic through retryLog, passes isRetryPending to both LogRowContextMenu and LogDetails; useCallback deps are correctly suppressed per project guidelines for stable TanStack Query refs. |
| apps/sim/app/workspace/[workspaceId]/logs/components/log-row-context-menu/log-row-context-menu.tsx | Context menu correctly gates the Retry item behind isRetryable and disables it while isRetryPending; shows "Retrying…" label during in-flight mutation. |
| apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx | Retry button added to sidebar header, correctly gated on log.status === 'failed' and disabled while isRetryPending. |
| apps/sim/lib/logs/types.ts | Adds workflowInput?: unknown to WorkflowExecutionLog.executionData — correctly typed; aligns with completeWorkflowExecution interface update. |
Sequence Diagram
sequenceDiagram
participant U as User
participant CM as ContextMenu / Sidebar
participant RL as retryLog()
participant QC as QueryClient
participant RE as useRetryExecution
participant API as /api/workflows/:id/execute
U->>CM: Right-click failed log / click Retry
CM->>RL: retryLog(log)
RL->>QC: fetchQuery(logKeys.detail(logId))
QC->>API: GET /api/logs/:logId
API-->>QC: WorkflowLog (with workflowInput)
QC-->>RL: detailLog
RL->>RL: extractRetryInput(detailLog)
note over RL: prefers workflowInput field,<br/>falls back to blockStates heuristic
RL->>RE: mutateAsync({ workflowId, input })
RE->>API: POST /execute {input, triggerType:"manual", stream:true}
API-->>RE: stream (first chunk)
RE->>RE: reader.read() then reader.cancel()
note over RE: execution continues server-side
RE-->>RL: { started: true }
RL-->>U: toast.success("Retry started")
RE->>QC: invalidate logs + details + stats
Comments Outside Diff (1)
-
apps/sim/lib/logs/execution/logger.ts, line 375-384 (link)workflowInputpersisted without API-key redactiontraceSpansandfinalOutputboth pass throughredactApiKeys()before reachingbuildCompletedExecutionData, butworkflowInputis forwarded as-is. Any credentials embedded in a workflow's input — OAuth tokens from webhook payloads, API keys passed via the API trigger, passwords in manual inputs — will be stored in plaintext in theexecutionDataJSON column and surfaced through the log detail endpoint to all users with log-view access.Since the unredacted value is needed for retry fidelity, one option is to store two fields:
workflowInput(redacted, for display) andworkflowInputRaw(encrypted or access-controlled, for retry only). Alternatively, if raw storage is intentional, the log-detail API response should explicitly filterworkflowInputbefore sending it to clients, and this should be documented.
Reviews (3): Last reviewed commit: "fix(logs): store workflowInput unredacte..." | Re-trigger Greptile
… heuristic, add isPending guard
|
@greptile |
|
@cursor review |
workflowInput is internal execution data used for replay, same as executionState which is also stored unredacted. Redacting at storage time corrupts the data for retry use cases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2591102. Configure here.
Summary
workflowInputin execution log data so it can be recovered for retryuseRetryExecutionmutation hook using streaming to avoid blocking on long workflowsexecutionState.blockStatesfor old logs that don't haveworkflowInputType of Change
Testing
Tested manually
Checklist