Skip to content

Commit 425aad5

Browse files
committed
fix(chat): refuse a chat update on a superseded or version-less deployment, matching the shared deploy path
1 parent b6985b4 commit 425aad5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎apps/sim/lib/chat-deployments/application/update-chat-deployment.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,22 @@ async function redeployWorkflowIfDrifted(workflowId: string, userId: string): Pr
143143
}
144144
throw new Error(message)
145145
}
146+
if (deployResult.latestDeploymentAttempt?.isCurrent === false) {
147+
throw new OrchestrationError(
148+
'conflict',
149+
'The workflow deployment attempt is historical and no longer describes production. Retry the chat update.'
150+
)
151+
}
146152
if (deployResult.latestDeploymentAttempt?.status !== 'active') {
147153
throw new OrchestrationError(
148154
'conflict',
149155
deployResult.warnings?.[0] ??
150156
'Workflow deployment is still preparing. Retry the chat update after it becomes active.'
151157
)
152158
}
159+
if (!deployResult.activeDeployment) {
160+
throw new Error('Workflow deployment reported active without a live deployment version.')
161+
}
153162
logger.info(`Redeployed workflow ${workflowId} for chat update (v${deployResult.version})`)
154163
}
155164

0 commit comments

Comments
 (0)