Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Jan 28, 2026

Summary

  • Pass in block logs for actual success logs
  • Do not display in the logs as output
  • Improve root error message in nested failure
  • Remove dead code

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 28, 2026 10:37pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR refactors trace span handling for nested child workflows to separate display concerns from execution tracking data. The key improvements are:

  • Cleaner output display: Introduced childTraceSpans field on BlockLog to store nested workflow trace spans separately from output, keeping output clean for user display
  • Better error messages: Nested workflow failures now show clear chains like Workflow chain: A → B | root error with proper workflow name tracking
  • Simplified processing: Removed complex span merging and deduplication logic from UI components, moving it upstream to the executor layer
  • Recursive filtering: Added filterHiddenOutputKeys() utility that recursively removes internal tracking fields like childTraceSpans from displayed output

The changes maintain backward compatibility by checking both log.childTraceSpans (new) and log.output.childTraceSpans (old) when processing trace spans.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean refactoring with proper backward compatibility, comprehensive test updates, and well-documented changes. The separation of concerns between display and tracking data is a solid architectural improvement.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/lib/logs/execution/trace-spans/trace-spans.ts Simplified trace span processing by removing merge logic and introducing filterHiddenOutputKeys utility for cleaner output display
apps/sim/executor/handlers/workflow/workflow-handler.ts Improved error messages for nested workflows with chain tracking and root error extraction
apps/sim/executor/execution/block-executor.ts Added childTraceSpans to block logs separately from output for cleaner display
apps/sim/executor/types.ts Added childTraceSpans field to BlockLog interface with documentation

Sequence Diagram

sequenceDiagram
    participant WH as WorkflowHandler
    participant BE as BlockExecutor
    participant WF as Child Workflow
    participant TS as TraceSpans Builder
    participant UI as Log Details UI
    
    Note over WH,UI: Success Path - Child Workflow Execution
    WH->>WF: Execute child workflow
    WF->>WH: Return execution result
    WH->>WH: captureChildWorkflowLogs(result)
    WH->>TS: buildTraceSpans(result)
    TS->>WH: Return trace spans
    WH->>WH: Transform spans with metadata
    WH->>BE: Return output with childTraceSpans
    BE->>BE: Extract childTraceSpans from output
    BE->>BE: Store childTraceSpans separately in blockLog
    BE->>BE: filterOutputForLog (removes childTraceSpans)
    Note over BE: Output is clean for display
    
    Note over WH,UI: Error Path - Nested Workflow Failure
    WH->>WF: Execute child workflow
    WF-->>WH: Throw error with result
    WH->>WH: captureChildWorkflowLogs(error.executionResult)
    WH->>TS: buildTraceSpans(result)
    TS->>WH: Return trace spans
    WH->>WH: parseNestedWorkflowError(error)
    WH->>WH: buildNestedWorkflowErrorMessage()
    Note over WH: Format: "workflow" failed: error<br/>or Workflow chain: A → B | error
    WH-->>BE: Throw ChildWorkflowError with childTraceSpans
    BE->>BE: Extract childTraceSpans from error
    BE->>BE: Store childTraceSpans in blockLog
    BE->>BE: filterOutputForLog (removes childTraceSpans)
    
    Note over WH,UI: Trace Span Processing
    UI->>TS: Request trace spans from logs
    TS->>TS: Check log.childTraceSpans (preferred)
    TS->>TS: Fallback to log.output.childTraceSpans
    TS->>TS: flattenWorkflowChildren(spans)
    TS->>TS: Clean childTraceSpans from output
    TS->>UI: Return processed spans
    UI->>UI: filterHiddenOutputKeys(finalOutput)
    Note over UI: Display clean output without childTraceSpans
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@icecrasher321 icecrasher321 merged commit 57f0837 into staging Jan 28, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/passing-childworkflow-spans branch January 29, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants