-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(copilot): fix execute workflow from diff store #1894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 files reviewed, no comments
* Fix run from diff store * Fix copilot run workflow
* Fix run from diff store * Fix copilot run workflow
Summary
Fix copilot run from diff store
Type of Change
Testing
Manual
Checklist