Expected Behavior
An invocation response with explicit Status=FAILED must result in a failed durable execution.
If an error object is required by the invocation contract, a FAILED response without one should be rejected or converted to a generic failure. It must never be converted into a successful execution.
Actual Behavior
In aws_durable_execution_sdk_python_testing.executor.Executor._validate_invocation_response_and_store(), the FAILED branch passes the nullable response error to _complete_workflow():
case InvocationStatus.FAILED:
self._complete_workflow(
execution_arn, result=None, error=response.error
)
_complete_workflow() then chooses the terminal status based on whether the error is present:
if error is not None:
self.fail_execution(execution_arn, error)
else:
self.complete_execution(execution_arn, result)
Consequently, this invocation response:
is recorded as ExecutionSucceeded.
This was observed through SAM Local with the Java SDK when waitForCondition exhausted its attempts inside a synchronous child context. The operation history was:
StepFailed (WaitForCondition)
ContextFailed (RunInChildContext)
InvocationCompleted
ExecutionSucceeded
The producing Java SDK issue is aws/aws-durable-execution-sdk-java#634.
Steps to Reproduce
The emulator can be tested directly with a handler/invoker that returns:
Alternatively:
- Run a Java durable handler through SAM Local.
- Inside synchronous
runInChildContext, execute waitForCondition with a built-in wait strategy and a condition that always continues polling.
- Allow the operation to exhaust its maximum attempts.
- Inspect the durable execution history.
The step and child context are recorded as failed, but the execution is recorded as succeeded.
SDK Version
aws-durable-execution-sdk-python-testing current main as of 2026-08-19. The affected code is used by the durable execution emulator image run by SAM Local.
Python Version
3.13
Is this a regression?
No known working version.
Last Working Version
N/A
Proposed Fix
Make the explicit invocation status authoritative:
case InvocationStatus.FAILED:
error = response.error or create_generic_failure_error()
self.fail_execution(execution_arn, error)
Alternatively, reject a FAILED response whose error is missing. Do not route the FAILED branch through logic that infers success from error is None.
Add a regression test asserting that:
InvocationStatus.FAILED with an error produces a failed execution;
InvocationStatus.FAILED without an error also cannot produce a successful execution;
- a
ContextFailed checkpoint does not itself force root failure when the handler legitimately catches it and returns SUCCEEDED.
Expected Behavior
An invocation response with explicit
Status=FAILEDmust result in a failed durable execution.If an error object is required by the invocation contract, a
FAILEDresponse without one should be rejected or converted to a generic failure. It must never be converted into a successful execution.Actual Behavior
In
aws_durable_execution_sdk_python_testing.executor.Executor._validate_invocation_response_and_store(), theFAILEDbranch passes the nullable response error to_complete_workflow():_complete_workflow()then chooses the terminal status based on whether the error is present:Consequently, this invocation response:
{ "Status": "FAILED" }is recorded as
ExecutionSucceeded.This was observed through SAM Local with the Java SDK when
waitForConditionexhausted its attempts inside a synchronous child context. The operation history was:The producing Java SDK issue is aws/aws-durable-execution-sdk-java#634.
Steps to Reproduce
The emulator can be tested directly with a handler/invoker that returns:
{ "Status": "FAILED" }Alternatively:
runInChildContext, executewaitForConditionwith a built-in wait strategy and a condition that always continues polling.The step and child context are recorded as failed, but the execution is recorded as succeeded.
SDK Version
aws-durable-execution-sdk-python-testingcurrentmainas of 2026-08-19. The affected code is used by the durable execution emulator image run by SAM Local.Python Version
3.13
Is this a regression?
No known working version.
Last Working Version
N/A
Proposed Fix
Make the explicit invocation status authoritative:
Alternatively, reject a
FAILEDresponse whose error is missing. Do not route theFAILEDbranch through logic that infers success fromerror is None.Add a regression test asserting that:
InvocationStatus.FAILEDwith an error produces a failed execution;InvocationStatus.FAILEDwithout an error also cannot produce a successful execution;ContextFailedcheckpoint does not itself force root failure when the handler legitimately catches it and returnsSUCCEEDED.