fix(orchestration): Use the step definition max retries on set step failure (#13319)

* fix(orchestration): Use the step definition max retries on set step failure

* Create sweet-turkeys-wait.md

* allow to force permanent failure

* update changeset
This commit is contained in:
Adrien de Peretti
2025-08-28 14:35:31 +02:00
committed by GitHub
parent cbaa403744
commit ff152e7ace
9 changed files with 64 additions and 15 deletions

View File

@@ -40,6 +40,13 @@ type RegisterStepSuccessOptions<T> = Omit<
"transactionId" | "input"
>
type RegisterStepFailureOptions<T> = Omit<
WorkflowOrchestratorRunOptions<T>,
"transactionId" | "input"
> & {
forcePermanentFailure?: boolean
}
type IdempotencyKeyParts = {
workflowId: string
transactionId: string
@@ -450,7 +457,7 @@ export class WorkflowOrchestratorService {
}: {
idempotencyKey: string | IdempotencyKeyParts
stepResponse: unknown
options?: RegisterStepSuccessOptions<T>
options?: RegisterStepFailureOptions<T>
}) {
const {
context,
@@ -458,6 +465,7 @@ export class WorkflowOrchestratorService {
resultFrom,
container,
events: eventHandlers,
forcePermanentFailure = false,
} = options ?? {}
let { throwOnError } = options ?? {}
@@ -484,6 +492,7 @@ export class WorkflowOrchestratorService {
throwOnError: false,
logOnError,
events,
forcePermanentFailure,
response: stepResponse,
container: container ?? this.container_,
})

View File

@@ -240,7 +240,9 @@ export class WorkflowsModuleService<
}: {
idempotencyKey: string | object
stepResponse: unknown
options?: Record<string, any>
options?: Record<string, any> & {
forcePermanentFailure?: boolean
}
},
@MedusaContext() context: Context = {}
) {