Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • surface integration triggers in logs instead of catchall (shows trigger Linear instead of webhook)

Type of Change

  • New feature

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 Nov 22, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Nov 22, 2025 9:25pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 22, 2025

Greptile Overview

Greptile Summary

This PR replaces the generic 'webhook' trigger type with specific integration names (e.g., 'Linear', 'Slack', 'GitHub') throughout the logs system, providing better visibility into which integrations triggered workflow executions.

Key Changes:

  • New API endpoint (/api/logs/triggers) fetches unique integration triggers from execution logs, excluding core types
  • Created get-trigger-options.ts utility that dynamically maps provider names to display labels and colors from the block registry
  • Updated webhook-execution.ts to use payload.provider as the trigger type instead of hardcoded 'webhook'
  • Enhanced UI components (logs table, sidebar, filters, search) to display integration-specific triggers with colored badges
  • Dynamic trigger options are now fetched and displayed based on actual log data rather than static lists

Issues Found:

  • search.tsx:76 uses console.error instead of logger.error (violates style guide)

Confidence Score: 4/5

  • This PR is safe to merge with one minor logging issue that should be fixed
  • Score reflects a well-architected change with proper auth, caching, and type safety. The implementation correctly propagates provider information through the execution pipeline and displays it consistently across the UI. Only issue is a style guide violation (console.error instead of logger.error) which doesn't affect functionality but should be corrected for consistency.
  • The search.tsx file needs the console.error fixed to use logger.error

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/api/logs/triggers/route.ts 5/5 New API endpoint to fetch unique integration triggers from logs, properly secured with auth and workspace permissions
apps/sim/lib/logs/get-trigger-options.ts 5/5 Utility to dynamically generate trigger options from registry, with caching for performance
apps/sim/background/webhook-execution.ts 5/5 Updated to use provider field from payload as trigger type instead of hardcoded 'webhook'
apps/sim/app/workspace/[workspaceId]/logs/components/search/search.tsx 4/5 Fetches dynamic integration triggers and displays with colored badges; has console.error instead of logger
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx 5/5 Added TriggerBadge component to display integration-specific trigger labels with colors

Sequence Diagram

sequenceDiagram
    participant W as Webhook Provider
    participant P as WebhookProcessor
    participant T as Trigger.dev Task
    participant E as webhook-execution.ts
    participant L as LoggingSession
    participant DB as Database
    participant U as Logs UI
    participant A as /api/logs/triggers
    participant M as get-trigger-options.ts

    Note over W,P: Webhook Execution Flow
    W->>P: POST /api/webhooks/trigger/[path]
    P->>P: Verify auth & parse payload
    P->>P: Create payload with provider field
    Note right of P: provider: 'linear', 'slack', etc.
    
    alt Trigger.dev enabled
        P->>T: tasks.trigger('webhook-execution', payload)
        T->>E: executeWebhookJob(payload)
    else Direct execution
        P->>E: executeWebhookJob(payload)
    end
    
    E->>L: new LoggingSession(workflowId, executionId, provider)
    Note right of L: Uses payload.provider as trigger type
    E->>E: Execute workflow blocks
    L->>DB: Insert log with trigger = provider
    Note right of DB: Stored as 'linear', 'slack', etc.<br/>instead of 'webhook'

    Note over U,M: Logs UI Display Flow
    U->>A: GET /api/logs/triggers?workspaceId=...
    A->>DB: SELECT DISTINCT trigger WHERE trigger NOT IN (core types)
    DB-->>A: ['linear', 'slack', 'github', ...]
    A->>M: getIntegrationMetadata(trigger)
    M->>M: Map to block name & color
    A-->>U: [{value: 'linear', label: 'Linear', color: '#...'}]
    
    U->>U: Display triggers with colors in filters
    U->>U: Display triggers in search suggestions
    U->>U: Display trigger badges in logs table
    U->>U: Display trigger in sidebar
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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit d1f0d21 into staging Nov 22, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/trigger-type branch November 22, 2025 22:18
MagellaX pushed a commit to MagellaX/sim that referenced this pull request Nov 23, 2025
…tchall 'webhook' trigger type (simstudioai#2102)

* improvement(logs): surface integration triggers in logs instead of  catchall

* optimized calculation, added new triggers to search

* cleanup

* fix console log
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