Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • surface handled errors as info in logs

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 Feb 11, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 11, 2026 5:08am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR implements a system to distinguish between handled and unhandled errors in workflow executions, ensuring that errors caught by error handler paths (error ports) are logged as info-level rather than error-level.

Key changes:

  • Added errorHandled flag to block logs and trace spans to mark errors caught by error ports
  • Updated workflow status determination to only fail on unhandled errors (errors without error ports)
  • Modified logging and telemetry to report handled errors as info/success and only unhandled errors as error/failed
  • Updated UI to correctly display error styling based on whether errors are handled
  • Error edges now display with error status when taken via error port
  • Comprehensive test coverage added for various scenarios (blocks, loops, parallel execution)

The implementation correctly propagates the errorHandled flag through iteration containers (loops/parallel) and checks tool call errors in the context of parent span's errorHandled status.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-designed with comprehensive test coverage. The logic correctly distinguishes between handled and unhandled errors across all execution contexts (blocks, loops, parallel). The errorHandled flag properly propagates through the trace span hierarchy, and the UI correctly respects this flag when displaying error states. All changes are backwards compatible (using optional fields).
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/executor/execution/block-executor.ts Sets errorHandled: true on block logs when error port exists, marking handled errors for downstream processing
apps/sim/lib/logs/execution/trace-spans/trace-spans.ts Propagates errorHandled through trace spans, iterations, and containers; updates workflow status logic to check unhandled errors
apps/sim/lib/logs/execution/logger.ts Updates workflow failure detection to only check unhandled errors when determining log level and status
apps/sim/lib/logs/execution/logging-session.ts Updates telemetry event status to only report unhandled errors
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/trace-spans/trace-spans.tsx Adds hasUnhandledErrorInTree function for root workflow spans to respect errorHandled flag and correctly display error states in UI
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts Updates edge status marking to show error edges with 'error' status when taken via error port

Sequence Diagram

sequenceDiagram
    participant Executor as Block Executor
    participant Log as Block Log
    participant TraceBuilder as Trace Spans Builder
    participant Logger as Execution Logger
    participant UI as Trace Spans UI

    Executor->>Executor: Check hasErrorPort()
    alt Has Error Port
        Executor->>Log: Set errorHandled = true
        Executor->>Executor: Return error output (don't throw)
    else No Error Port
        Executor->>Executor: Throw error
    end

    Log->>TraceBuilder: Build trace spans from logs
    TraceBuilder->>TraceBuilder: Copy errorHandled to spans
    TraceBuilder->>TraceBuilder: Propagate to iterations/containers
    TraceBuilder->>TraceBuilder: Check for unhandled errors
    alt Has Unhandled Errors
        TraceBuilder->>TraceBuilder: Set workflow status = 'error'
    else All Errors Handled
        TraceBuilder->>TraceBuilder: Set workflow status = 'success'
    end

    TraceBuilder->>Logger: Pass trace spans
    Logger->>Logger: checkSpanForErrors(errorHandled check)
    alt Has Unhandled Errors
        Logger->>Logger: Set level = 'error', status = 'failed'
    else No Unhandled Errors
        Logger->>Logger: Set level = 'info', status = 'completed'
    end

    TraceBuilder->>UI: Display spans
    UI->>UI: hasUnhandledErrorInTree(span)
    alt Root Workflow Span
        UI->>UI: Use hasUnhandledErrorInTree()
    else Other Spans
        UI->>UI: Use hasErrorInTree()
    end
    UI->>UI: Apply error styling based on result
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.

11 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

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.

11 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

@waleedlatif1 waleedlatif1 merged commit 13a9111 into staging Feb 11, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/info branch February 11, 2026 05:21
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.

1 participant