Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(mcp): editing a skipped step through chat keeps it skipped (#16858)

Hazem Adeleae33a59ba91
diff --git a/packages/core/execution/src/lib/flows/operations/update-action.ts b/packages/core/execution/src/lib/flows/operations/update-action.ts
index 4432e0cfa51..3aa5e869b9b 100644
--- a/packages/core/execution/src/lib/flows/operations/update-action.ts
+++ b/packages/core/execution/src/lib/flows/operations/update-action.ts
@@ -16,7 +16,7 @@ function _updateAction(flowVersion: FlowVersion, request: UpdateActionRequest):
displayName: request.displayName,
name: request.name,
valid: false,
- skip: request.skip,
+ skip: request.skip ?? ('skip' in stepToUpdate ? stepToUpdate.skip : undefined),
lastUpdatedDate: dayjs().toISOString(),
settings: {
...stepToUpdate.settings,
diff --git a/packages/core/execution/test/flow/skipped-steps.test.ts b/packages/core/execution/test/flow/skipped-steps.test.ts
index be1e0a78a8a..87f3c4c0bd3 100644
--- a/packages/core/execution/test/flow/skipped-steps.test.ts
+++ b/packages/core/execution/test/flow/skipped-steps.test.ts
@@ -83,6 +83,14 @@ function rename(flowVersion: FlowVersion): FlowVersion {
return flowOperations.apply(flowVersion, { type: FlowOperationType.CHANGE_NAME, request: { displayName: 'Renamed' } })
}
+function updateStep({ flowVersion, skip }: { flowVersion: FlowVersion, skip?: boolean }): FlowVersion {
+ const { settings } = codeStep({ name: 'step_1' })
+ return flowOperations.apply(flowVersion, {
+ type: FlowOperationType.UPDATE_ACTION,
+ request: { type: FlowActionType.CODE, name: 'step_1', displayName: 'Renamed step', valid: true, settings, skip },
+ })
+}
+
describe('flowStructureUtil.getSkippedStepNames', () => {
it('includes a skipped loop and every step inside it, but not the step after it', () => {
const flowVersion = flowWith(loopStep({
@@ -148,3 +156,15 @@ describe('flow version validity with skipped steps', () => {
expect(rename(flowVersion).valid).toBe(false)
})
})
+
+describe('updating a skipped step', () => {
+ it('keeps it skipped when the update does not mention skip', () => {
+ const flowVersion = flowWith(codeStep({ name: 'step_1', skip: true }))
+ expect(flowStructureUtil.getActionOrThrow('step_1', updateStep({ flowVersion }).trigger).skip).toBe(true)
+ })
+
+ it('un-skips it when the update says so', () => {
+ const flowVersion = flowWith(codeStep({ name: 'step_1', skip: true }))
+ expect(flowStructureUtil.getActionOrThrow('step_1', updateStep({ flowVersion, skip: false }).trigger).skip).toBe(false)
+ })
+})