fix(copilot): fix execute workflow from diff store#1894
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryImplemented execution of diff workflows (AI-proposed workflow changes) by threading a Key changes:
The implementation correctly handles the precedence order: workflowStateOverride → draftState → deployedState, ensuring diff workflows execute with the AI-proposed changes rather than the current canvas state. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as Client/Copilot
participant Hook as useWorkflowExecution
participant Utils as workflow-execution-utils
participant DiffStore as WorkflowDiffStore
participant API as /api/workflows/[id]/execute
participant Core as executeWorkflowCore
participant Executor as Workflow Executor
Note over Client,Hook: User executes workflow (manual/copilot)
Client->>Hook: executeWorkflow()
Hook->>DiffStore: Check hasActiveDiffWorkflow
DiffStore-->>Hook: isDiffReady && isShowingDiff && diffWorkflow
alt Diff workflow active
Hook->>Hook: Set executionWorkflowState = diffWorkflow
Note right of Hook: Use diff blocks/edges instead of current
else No diff workflow
Hook->>Hook: Use currentWorkflow.blocks/edges
end
Hook->>API: POST /execute with workflowStateOverride
Note right of Hook: Payload includes:<br/>- workflowStateOverride (if diff active)<br/>- useDraftState: true<br/>- stream: true
API->>API: Validate request body
API->>API: Create ExecutionMetadata with workflowStateOverride
API->>Core: executeWorkflowCore(snapshot)
alt workflowStateOverride provided
Core->>Core: Use override.blocks/edges/loops/parallels
Note right of Core: Priority: override > draftState > deployed
else useDraftState
Core->>Core: Load from normalized tables
else deployed
Core->>Core: Load deployed state
end
Core->>Executor: Execute workflow with selected state
Executor-->>Core: ExecutionResult
Core-->>API: ExecutionResult
API->>Client: SSE Stream (block:completed, execution:completed)
Note over Client,Executor: Copilot execution path
Client->>Utils: executeWorkflowWithFullLogging()
Utils->>DiffStore: Check hasActiveDiffWorkflow
DiffStore-->>Utils: Diff workflow state
Utils->>API: POST /execute with workflowStateOverride
API-->>Utils: SSE Stream
Utils->>Utils: Parse SSE events & add to console
Utils-->>Client: ExecutionResult
|
waleedlatif1
pushed a commit
that referenced
this pull request
Nov 12, 2025
* Fix run from diff store * Fix copilot run workflow
waleedlatif1
pushed a commit
that referenced
this pull request
Nov 12, 2025
* Fix run from diff store * Fix copilot run workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix copilot run from diff store
Type of Change
Testing
Manual
Checklist