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

@@ -48,6 +48,13 @@ type RegisterStepSuccessOptions<T> = Omit<
"transactionId" | "input"
>
type RegisterStepFailureOptions<T> = Omit<
WorkflowOrchestratorRunOptions<T>,
"transactionId" | "input"
> & {
forcePermanentFailure?: boolean
}
type IdempotencyKeyParts = {
workflowId: string
transactionId: string
@@ -493,7 +500,7 @@ export class WorkflowOrchestratorService {
}: {
idempotencyKey: string | IdempotencyKeyParts
stepResponse: unknown
options?: RegisterStepSuccessOptions<T>
options?: RegisterStepFailureOptions<T>
}) {
const {
context,
@@ -501,6 +508,7 @@ export class WorkflowOrchestratorService {
resultFrom,
container,
events: eventHandlers,
forcePermanentFailure,
} = options ?? {}
let { throwOnError } = options ?? {}
@@ -529,6 +537,7 @@ export class WorkflowOrchestratorService {
events,
response: stepResponse,
container: container ?? this.container_,
forcePermanentFailure,
})
if (ret.transaction.hasFinished()) {

View File

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