aws / aws/aws-durable-execution-sdk-java

[Feature]: Exit gracefully with PENDING when a checkpoint response has no CheckpointToken

オープン
#706 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement needs-triage pkg:sdk project
主要言語
Java
スター
28
フォーク
11
平均マージ
1日 8時間
マージ済み PR(30日)
47

説明

### What would you like?

When a checkpoint response arrives without a `CheckpointToken`, the SDK should treat it as a signal that the service will accept no further checkpoints from this invocation. The SDK should stop issuing checkpoints and end the invocation cleanly with `Status: PENDING`.

Why PENDING and not FAILED or a thrown error:
- A missing token does not mean the execution is finished. It means this invocation cannot make further progress. The invocation result must not claim the execution finished.
- A thrown error is an invocation failure. Lambda retries it, but the retry has no valid token and can do nothing useful. It also puts an error in customer logs for a condition the SDK understood.
- PENDING is already what the SDK returns for every suspend (wait, scheduled retry, pending callback). This is a suspend: the invocation is done for now and the execution continues later.

### Current behavior

`CheckpointManager.java` assigns the response token unconditionally:

```java
checkpointToken = response.checkpointToken();
```

So after a response with no token, `checkpointToken` is null. The next checkpoint call passes null to the client. The outcome is either a client-side parameter validation exception or a service `InvalidParameterValueException: Invalid checkpoint token` rejection; I have not verified which. A client-side exception is not an `AwsServiceException`, so `DurableApiErrorClassifier.classifyException` never sees it and it propagates as-is. A service rejection is classified per #705: with that fix it is a retryable invocation error and the handler throws; without it, the execution fails. In no case does the SDK return PENDING.

### Possible Implementation

1. After the checkpoint call, if `response.checkpointToken()` is null, mark the manager as suspended-by-service, stop issuing further checkpoints, and complete any pending pollers so no thread blocks on a checkpoint that will never happen.
2. Route the outcome through the existing suspension path that returns `InvocationStatus.PENDING` (the same path used by waits and callbacks).
3. In-flight operations are abandoned, not checkpointed. On the next invocation they replay. This is correct for AT_LEAST_ONCE steps. AT_MOST_ONCE steps whose START landed in the last accepted checkpoint will not run again, which is the defined semantics of AT_MOST_ONCE.
4. Unit test: a checkpoint response with a null token produces `PENDING`, no further checkpoint calls, and no thrown exception.
5. Testing module: the local runner needs a way to omit the token on a chosen checkpoint so customers can test their handlers against this path.

### Is this a breaking change?

No. The SDK's response set is unchanged; a new internal termination reason is added.

### Additional Context

- Prerequisite: #705 (message-case bug in stale-token classification). That fix is the fallback path whenever the missing token is not detected, so it should land first.
- Sibling issues in the JS and Python SDKs are linked in a comment below.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

CheckpointManager.java から始め、チェックポイント応答の処理と、InvocationStatus.PENDING を返す既存のサスペンションパスを追跡します。DurableApiErrorClassifier とテストモジュールのローカルランナーを確認し、null トークンが PENDING を返し、その後のチェックポイント呼び出しを行わず、例外をスローしないことを示すテストカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
backend, testing
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。