Skip to content

Commit 5493e78

Browse files
author
test
committed
fix(workflows): sync MCP tools on revert
1 parent 2d4271d commit 5493e78

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getAuditActorMetadata } from '@/lib/audit/actor-metadata'
66
import { AuditAction, AuditResourceType, recordAudit } from '@/lib/audit/log'
77
import { env } from '@/lib/core/config/env'
88
import { generateRequestId } from '@/lib/core/utils/request'
9+
import { syncMcpToolsForWorkflow } from '@/lib/mcp/workflow-mcp-sync'
910
import { saveWorkflowToNormalizedTables } from '@/lib/workflows/persistence/utils'
1011
import { validateWorkflowAccess } from '@/app/api/workflows/middleware'
1112
import { createErrorResponse, createSuccessResponse } from '@/app/api/workflows/utils'
@@ -101,6 +102,13 @@ export async function POST(
101102
.set({ lastSynced: new Date(), updatedAt: new Date() })
102103
.where(eq(workflow.id, id))
103104

105+
await syncMcpToolsForWorkflow({
106+
workflowId: id,
107+
requestId,
108+
state: deployedState,
109+
context: 'revert',
110+
})
111+
104112
try {
105113
const socketServerUrl = env.SOCKET_SERVER_URL || 'http://localhost:3002'
106114
await fetch(`${socketServerUrl}/api/workflow-reverted`, {

apps/sim/app/api/workflows/[id]/route.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,6 @@ describe('Workflow By ID API Route', () => {
406406
where: vi.fn().mockResolvedValue([{ id: 'workflow-123' }, { id: 'workflow-456' }]),
407407
}),
408408
})
409-
mockDbDelete.mockReturnValue({
410-
where: vi.fn().mockResolvedValue([{ id: 'workflow-123' }]),
411-
})
412409
setupGlobalFetchMock({ ok: true })
413410

414411
const req = new NextRequest('http://localhost:3000/api/workflows/workflow-123', {

0 commit comments

Comments
 (0)