Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • add copilot as a trigger type

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 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:35am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR introduces a new core trigger type, copilot, and wires it through execution + logging + UI display:

  • Adds copilot to the core trigger type union (CORE_TRIGGER_TYPES) so API validation and filters accept it.
  • Ensures copilot-run workflows (client SSE tools and server-side copilot mutations) stamp executions with triggerType: 'copilot' for consistent logging/metadata.
  • Updates log UI to display copilot with a dedicated badge color by adding a pink badge variant and mapping copilot to it.

Overall, the change fits existing trigger handling patterns (core trigger enum → execute endpoint validation → LoggingSession metadata → log filtering/display).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Changes are additive and consistent across the trigger validation (CORE_TRIGGER_TYPES), execution metadata (workflowTriggerType/overrideTriggerType), and UI rendering (badge variant + mapping). No behavioral changes to execution logic beyond tagging the trigger type.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/logs/utils.ts Adds 'copilot' trigger mapping to use the new pink Badge variant; no functional changes beyond display mapping.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts Extends overrideTriggerType union to include 'copilot', enabling client execution payloads to be validated/typed correctly.
apps/sim/components/emcn/components/badge/badge.tsx Adds new 'pink' status badge variant and includes it in STATUS_VARIANTS; no behavior changes to other variants.
apps/sim/lib/copilot/client-sse/run-tool-execution.ts For client-side copilot run tools, sets overrideTriggerType to 'copilot' so executions are logged/tagged with the correct trigger.
apps/sim/lib/copilot/orchestrator/tool-executor/workflow-tools/mutations.ts Passes workflowTriggerType: 'copilot' into executeWorkflow for server-side copilot tool mutations, ensuring logs/metadata tag the trigger.
apps/sim/lib/logs/get-trigger-options.ts Adds 'copilot' to trigger filter options with a pink color for UI selection.
apps/sim/lib/workflows/executor/execute-workflow.ts Extends ExecuteWorkflowOptions.workflowTriggerType union to include 'copilot'; implementation treats it as a string used for logging/metadata.
apps/sim/stores/logs/filters/types.ts Adds 'copilot' to CORE_TRIGGER_TYPES so API schema validation and log filters recognize the trigger as core.

Sequence Diagram

sequenceDiagram
  participant CopilotClient as Copilot Client
  participant ClientExec as executeWorkflowWithFullLogging()
  participant ExecuteAPI as POST /api/workflows/:id/execute
  participant Orchestrator as Copilot Orchestrator
  participant ExecWorkflow as executeWorkflow()
  participant CoreExec as executeWorkflowCore
  participant Logs as LoggingSession

  CopilotClient->>ClientExec: executeRunToolOnClient(...)
  ClientExec->>ExecuteAPI: fetch(triggerType="copilot", useDraftState=true)
  ExecuteAPI->>Logs: new LoggingSession(triggerType="copilot")
  ExecuteAPI->>CoreExec: executeWorkflowCore(...)
  CoreExec-->>ExecuteAPI: streaming events + result
  ExecuteAPI-->>ClientExec: SSE response
  ClientExec-->>CopilotClient: update tool state + reportCompletion

  Orchestrator->>ExecWorkflow: executeRunWorkflow(..., workflowTriggerType="copilot")
  ExecWorkflow->>Logs: new LoggingSession(triggerType="copilot")
  ExecWorkflow->>CoreExec: executeWorkflowCore(...)
  CoreExec-->>ExecWorkflow: ExecutionResult
  ExecWorkflow-->>Orchestrator: ToolCallResult
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.

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Additional Comments (2)

apps/sim/lib/copilot/orchestrator/tool-executor/workflow-tools/mutations.ts
Copilot start-block misrouting

These mutations set workflowTriggerType: 'copilot', but executeWorkflowCore currently maps any triggerType other than 'api'|'chat' to executionKind = 'manual' when resolving the start block (apps/sim/lib/workflows/executor/execution-core.ts:226-230). That means copilot-triggered runs will pick the manual/unified start block (or throw “No start block found”) rather than whatever behavior is intended for copilot. This PR should also update the trigger-kind mapping (or extend StartExecutionKind / priorities) so 'copilot' resolves deterministically.

Also appears at: apps/sim/lib/copilot/client-sse/run-tool-execution.ts:115-122 (passes overrideTriggerType: 'copilot').


apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts
Trigger type unions out of sync

WorkflowExecutionOptions.overrideTriggerType was widened to include 'copilot', but the higher-level hook apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts:1040-1045 still types overrideTriggerType?: 'chat' | 'manual' | 'api'. That means callers using the hook can’t pass 'copilot' (TS error), even though copilot execution now relies on it. Update the hook signature (or use a shared CoreTriggerType/string) to keep these in sync.

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1 waleedlatif1 merged commit 3d5bd00 into staging Feb 11, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/trigger branch February 11, 2026 05:36
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.

8 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

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