aws / aws/aws-durable-execution-sdk-js
[Bug]: Invalid checkpoint token misclassified as execution failure (message case mismatch)
- Dominant language
- TypeScript
- Stars
- 84
- Forks
- 28
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 43
Description
### Expected Behavior
When the service rejects a checkpoint call with `InvalidParameterValueException` because the checkpoint token is stale (a newer invocation superseded this one), the SDK should classify the error as an **invocation** failure (retryable). The current invocation ends, and the service starts a fresh invocation with a fresh token. The execution itself continues.
### Actual Behavior
The SDK classifies the error as an **execution** failure (non-retryable). So a stale checkpoint token fails the whole durable execution every time.
### Root Cause
The classifier matches the error message with a case-sensitive prefix check against `"Invalid Checkpoint Token"`. The service emits `"Invalid checkpoint token"` (lowercase `c` and `t`). The prefix check never matches. The error falls through to the generic 4xx branch, which is classified as an execution failure.
Service constant (`DurableExecutionsServiceSharedLib`, `ValidationErrorMessages.java` line 86, internal):
```java
public static final String INVALID_CHECKPOINT_TOKEN = "Invalid checkpoint token";
```
SDK check (`packages/aws-durable-execution-sdk-js/src/utils/checkpoint/checkpoint-manager.ts`):
https://github.com/aws/aws-durable-execution-sdk-js/blob/b16eafb20db51ee13404882e4aa90976bd22230e/packages/aws-durable-execution-sdk-js/src/utils/checkpoint/checkpoint-manager.ts#L336
```ts
errorName === "InvalidParameterValueException" &&
errorMessage.startsWith("Invalid Checkpoint Token")
```
Test that encodes the wrong string: `src/utils/checkpoint/checkpoint-error-classification.test.ts` (`"Invalid Checkpoint Token: token expired"`).
### Steps to Reproduce
1. Have the service return a 4xx `InvalidParameterValueException` whose message starts with `Invalid checkpoint token` (the real service message).
2. Pass it through the SDK error classifier.
3. Observe it is classified as an execution (non-retryable) error rather than an invocation (retryable) error.
The existing unit tests do not catch this. They construct the error with the message `"Invalid Checkpoint Token: token expired"`, which matches the SDK constant rather than the service constant.
### Proposed Fix
1. Change the SDK constant to `"Invalid checkpoint token"` so it matches the service.
2. Consider a case-insensitive comparison to protect against future drift.
3. Update the unit tests to use the real service message.
### Related
Same defect exists in all three SDKs; each gets its own issue.
- JS: aws/aws-durable-execution-sdk-js
- Python: aws/aws-durable-execution-sdk-python
- Java: aws/aws-durable-execution-sdk-java
### SDK Version
main (b16eafb)
### Node.js Version
22.x
Contributor guide
Research direction
Start in packages/aws-durable-execution-sdk-js/src/utils/checkpoint/checkpoint-manager.ts around line 336, then read src/utils/checkpoint/checkpoint-error-classification.test.ts. Run the checkpoint error-classification tests using the real service message, "Invalid checkpoint token". Done means stale-token errors classify as retryable invocation failures rather than non-retryable execution failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100