Skip to content

feat: add filesystem payload offloader and retries - #681

Open
zhongkechen wants to merge 1 commit into
issue-463-payload-offloaderfrom
issue-463-payload-offloader-filesystem
Open

feat: add filesystem payload offloader and retries#681
zhongkechen wants to merge 1 commit into
issue-463-payload-offloaderfrom
issue-463-payload-offloader-filesystem

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Stack

Layer PR Scope
Architecture #678 ADR-006 and design decision
1 #649 Core API, envelopes, runtime, operations
2 #681 (this PR) Filesystem implementation and retries
3 #682 Testing utilities and integration coverage
4 #683 Examples, E2E infrastructure, and implementation docs

Scope

  • add FileSystemPayloadOffloader in the core SDK
  • publish immutable unique files with CREATE_NEW
  • enforce SecureDirectoryStream, no-follow access, direct-child confinement, ownership binding, and SHA-256 verification
  • support ALWAYS/OVERFLOW, URI/hash path encodings, envelope-size limits, and structured/custom previews
  • add RetryPayloadOffloader for explicitly retryable storage failures
  • add focused filesystem, preview, integrity, provider, symlink, retry, and interruption tests

Intentionally excluded:

  • testing-runner/history integration
  • cloud/local integration scenarios
  • examples, E2E infrastructure, and documentation

Validation

  • full eight-module Maven reactor on Java 17
  • git diff --check
  • mvn spotless:check

Related to #463.

Comment on lines +75 to +80
Thread.currentThread().interrupt();
var interrupted = new RetryablePayloadOffloadException(
String.format("Interrupted while waiting to retry payload %s after attempt %d", action, attempt),
e);
interrupted.addSuppressed(failure);
throw interrupted;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review · Finding arf_v1_5vmint2jktj7b53xftxnhr7dib

[P1] An interrupted backoff is converted to RetryablePayloadOffloadException. DurableExecutor treats this subtype as RETRYING, so cancellation can trigger a fresh Lambda invocation and repeat storage work. The filesystem classifier similarly marks actual I/O interruptions retryable. Restore the interrupt flag but throw a non-retryable PayloadOffloadException, and classify ClosedByInterruptException or an interrupt-signaled InterruptedIOException as permanent interruption.

Comment on lines +87 to +90
var inlinePayload = OffloadedPayload.inline(
serializedPayload, context.durableExecutionArn(), context.entityId(), payloadDigest)
.bindProducer(context, payloadDigest);
if (fitsCheckpoint(inlinePayload)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review · Finding arf_v1_6olmknqlyp3zhgezq3cu4y2oso

[P1] OVERFLOW sizing materializes the complete escaped envelope and then another UTF-8 byte array through PayloadCodec.envelopeSizeBytes. For the multi-megabyte payloads this offloader is intended to handle, these extra full-size copies can exhaust Lambda memory before the code chooses filesystem storage. Short-circuit when a bounded UTF-8 count already exceeds the limit, and perform exact envelope encoding only for near-boundary payloads.

Comment on lines +197 to +200
var expectedPrefix = payloadOwnerPrefix(payload.ownerDurableExecutionArn(), payload.ownerEntityId())
+ "-"
+ payload.payloadDigest()
+ "-";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review · Finding arf_v1_2cuyghirtpc6zjugxs55p2ygo2

[P2] Loading recomputes the expected filename using the current pathEncoding. An in-flight execution that wrote a URI-form reference will therefore fail replay after configuration changes to HASH, despite the persisted reference, owner, and digest remaining valid. Make encoding a write-only choice by accepting both versioned filename formats during load, or persist the encoding with the reference, and add a cross-configuration replay test.

import software.amazon.lambda.durable.offload.PayloadStorageMode;
import software.amazon.lambda.durable.offload.SerDesPayloadKind;

class FileSystemPayloadOffloaderTest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review · Finding arf_v1_nlr5gumo4w2iw45unbkquvbkep

[P2] The new public offloader is tested only through direct method calls. That does not exercise DurableConfig, PayloadCodec, executor routing, checkpoint persistence, or replay, and project rules require integration coverage for public API changes. Add a LocalDurableTestRunner test that configures this offloader and verifies checkpoint/suspend/replay loading, including an OVERFLOW payload and retryable storage failure.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex AI review

Found four actionable issues affecting interruption handling, large-payload reliability, replay compatibility, and required integration coverage.

Reviewed commit 578208f0b55d4110cb89acd77a1e5923488e80d6. Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant