Skip to content

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

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

zhongkechen wants to merge 16 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 67bad28cd9ef1b0808bed193f8a15be75ce457ed 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

Final head d9b251c5003c03e997df6d07dd05116441509a88 also includes the reviewed #728 harness-only follow-up.

  • Full Java 17 upstream integration passed mvn -o -B clean spotless:apply verify: all ten modules, 3,001 tests passed, 34 conditional/cloud skips, zero failures/errors. This includes the public delayed-descendant FLAT/NESTED map/parallel replay controls and upstream lifecycle, token-revocation, worker-scope, and large-result controls.
  • Final task-publication source at 15d8eb2c0053cd625b30679993330e6f8f0b58da: all 77 focused Java 17 lifecycle/admission/manager/replay controls and 11 Java 25 lifecycle controls passed. The cancellation-observer, caller-runs, late-result replay, and gated success/failure publication regressions failed on their pre-fix versions and pass after their fixes.
  • All 179 Python LMI harness tests passed on the final merged head, including the delayed-log/escape ledger regressions from test: add LMI cloud lifecycle and concurrency regressions #728.
  • The task-registry control waits for actual exit() signals rather than logical result completion. Formatting and git diff --check pass. Current-head CI is tracked separately.
  • Cloud LMI execution was not repeated. No existing conformance requirement or cloud acceptance 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
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 October 16, 2026 22:53 — 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 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

Copy link
Copy Markdown
Contributor

Codex AI review

No actionable findings in the PR changes. Residual test risk: concurrency, cancellation, and replay behavior were reviewed statically; tests were not executed.

Reviewed commit d9b251c5003c03e997df6d07dd05116441509a88. Workflow run

This branch was successfully deployed

1 active deployment
ai-pr-review-runtime — d9b251c5 Deployed Oct 17, 2026 by zhongkechen via ai-pr-review / Codex review / Generate Codex review #2410
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