Skip to content

feat: add invocation-scoped task lifecycle foundation - #731

Closed
zhongkechen wants to merge 18 commits into
test/lmi-cloud-lifecyclefrom
feature/lmi-invocation-scope
Closed

zhongkechen wants to merge 18 commits into
test/lmi-cloud-lifecyclefrom
feature/lmi-invocation-scope

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Issue Link, if available

Foundation for #726. Stacked on #728 and targeting test/lmi-cloud-lifecycle; retarget to main after that prerequisite lands. Invocation deadlines and bounded cleanup remain in #733; opt-in per-invocation executors remain in #735.

Description

Give each invocation an ExecutionManager-owned task lifecycle that coordinates task submission, operation admission, polling, and checkpoint shutdown. Tasks register before dispatch and track logical completion separately from their interruptible handle and actual exit. The branch incorporates upstream main d64973fc6b1fb2fe69c0bce421e99a4aad417add through #728.

  • Bind the FutureTask before executor dispatch so a saturated CallerRunsPolicy task can be interrupted while submission is still on the stack. Atomically select result publication or cancellation: a selected success/failure cannot be overtaken by cancellation, and cancellation-winning workers cannot publish a competing result. Physical cancellation precedes logical cancellation; registry removal precedes the actual exit signal.
  • During DRAINING, already-admitted child/map/parallel work can register and run descendants, including delayed nested steps. Root and unrelated new work are rejected. Exact manager ownership prevents cross-invocation leakage on reused or inline executor threads.
  • Drain registered operation trees repeatedly, then close ordinary admission atomically with the final empty task snapshot. Checkpoint and poll enqueue calls hold short admission permits and execute outside admissionLock; shutdown waits for admitted enqueue calls before its final flush. An interrupted drain stays DRAINING so subsequent cleanup can persist results from already-admitted work for replay.
  • Preserve main's handler-owned Start, user cleanup, output preparation, and End lifecycle, including deliberate worker escape on fatal/MDC cleanup failures. Closed polls retain main's failed suspension future. The reserved internal terminal execution-result checkpoint remains explicitly awaited after ordinary operation admission closes.
  • Preserve public durable APIs, checkpoint identities, upstream token-revocation behavior, and replayed successes/failures. This is a lifecycle foundation, not a claim that invocation deadlines, noncooperative cleanup, or arbitrary bounded-executor nesting are solved. Ordinary result observers still execute on their publishing worker and must not self-join that worker's exit.

Testing

Head 3faa40c19f77704b3fe2b3a90b365e61126e47d2 has validated tree a74e74d7fd1b40f80da78eb05d982363994b7ef4 and includes upstream main d64973fc6b1fb2fe69c0bce421e99a4aad417add through #728. The runtime patch relative to #728 is unchanged by this synchronization.

  • Java 17: full clean mvn -B clean spotless:check verify passed all ten reactor modules, with 3,283 tests passed, 34 conditional/cloud tests skipped, and zero failures/errors.
  • Public delayed-descendant FLAT/NESTED map/parallel replay controls passed, including a child that creates a grandchild/leaf after the root returns; invocation completion waits for the leaf, its result is checkpointed, and replay does not repeat its effect.
  • An independent public probe that registers a fifth nested step during the one-pass map drain fails on current main and passes here: End waits for the newly admitted step to exit. refactor(plugin)!: create one plugin instance per invocation #782 must consume this lifecycle foundation before its End-ordering guarantee can cover that case.
  • All 202 Python LMI harness tests passed. Unfiltered Spotless, git diff --check, and clean working-tree verification passed.
  • No new cloud LMI acceptance run is claimed. No cloud or conformance assertion was weakened.

Checklist

  • Added and retained task admission, cancellation, shutdown, and replay coverage
  • Preserved Java 17 compatibility and existing public durable APIs
  • Kept the stacked base on test/lmi-cloud-lifecycle
  • Integrated current upstream main without reverting its lifecycle and token semantics

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@zhongkechen
zhongkechen added this pull request to stack #732 September 24, 2026 23:12
@zhongkechen
zhongkechen force-pushed the feature/lmi-invocation-scope branch 2 times, most recently from 02edc13 to ebad82c Compare September 25, 2026 22:20
@zhongkechen
zhongkechen marked this pull request as ready for review September 25, 2026 22:21
@zhongkechen
zhongkechen requested a review from a team September 25, 2026 22:21
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime September 25, 2026 22:21 — with GitHub Actions Active
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime September 25, 2026 22:24 — with GitHub Actions Active
Comment thread sdk/src/main/java/software/amazon/lambda/durable/execution/ExecutionManager.java Outdated
Comment thread sdk/src/main/java/software/amazon/lambda/durable/execution/ExecutionManager.java Outdated
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen force-pushed the feature/lmi-invocation-scope branch from 092a4a2 to d81fee3 Compare September 25, 2026 22:58
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime September 25, 2026 23:02 — with GitHub Actions Active
Comment thread sdk/src/main/java/software/amazon/lambda/durable/execution/ExecutionManager.java Outdated
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen force-pushed the feature/lmi-invocation-scope branch from d81fee3 to 18759d5 Compare September 29, 2026 17:14
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime September 29, 2026 17:28 — with GitHub Actions Active
@zhongkechen
zhongkechen force-pushed the feature/lmi-invocation-scope branch from 18759d5 to fba3f18 Compare September 29, 2026 17:39
@zhongkechen
zhongkechen force-pushed the feature/lmi-invocation-scope branch from fba3f18 to 73b4b16 Compare September 29, 2026 17:49
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime September 29, 2026 18:29 — with GitHub Actions Active
Comment thread sdk/src/main/java/software/amazon/lambda/durable/execution/ExecutionManager.java Outdated
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime September 29, 2026 20:17 — with GitHub Actions Active
Comment thread sdk/src/main/java/software/amazon/lambda/durable/execution/ExecutionManager.java Outdated
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen force-pushed the feature/lmi-invocation-scope branch from 94b2803 to bc29489 Compare September 29, 2026 22:12
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 16, 2026 23:40 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 17, 2026 00:08 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 17, 2026 00:32 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 17, 2026 00:50 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 17, 2026 01:04 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 17, 2026 01:34 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 20, 2026 22:59 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 20, 2026 23:28 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Codex AI review

No actionable findings in the PR changes. Tests were not executed under the read-only review constraints; runtime concurrency and cloud behavior remain unverified.

Reviewed commit 3faa40c19f77704b3fe2b3a90b365e61126e47d2. Workflow run

@zhongkechen

Copy link
Copy Markdown
Contributor Author

The invocation task registry, admission/cancellation controls, descendant draining and associated tests were incorporated into merged #782, now on main at 953c3771d4374a8bfeaa8653b133a8fa83d624dd, together with its factory and owner-End updates. Closing this PR as incorporated; #733 and #735 retain their separate remaining work.

@zhongkechen
zhongkechen deleted the feature/lmi-invocation-scope branch October 21, 2026 17:01

This branch was successfully deployed

1 active deployment
ai-pr-review-runtime — 3faa40c1 Deployed Oct 20, 2026 by zhongkechen via ai-pr-review / Codex review / Generate Codex review #2511
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