Conversation
Generated-by: Codex (GPT-5) Co-authored-by: Codex <codex@openai.com>
Contributor
Author
|
@pltbkd @da-daken @joeyutong Would you mind taking a look at this PR at your convenience? |
da-daken
approved these changes
Sep 17, 2026
da-daken
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Just a non-blocking comment—take a look when you get a chance.
| * the callable to a thread pool, and resumes when complete. On JDK < 21, this falls back to | ||
| * synchronous execution. | ||
| * <p>Creating the returned handle does not execute the callable or reserve durable state. Use | ||
| * {@link #await(DurableFuture)} to execute a single call, or {@link #gather(List)} to compose |
Contributor
There was a problem hiding this comment.
Would it be better to add a description about parallelism?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue: #1122
Purpose of change
This makes asynchronous durable calls composable in Java and Python without requiring users to construct a separate batch-call descriptor.
Runtime flow
durableExecuteAsync/durable_execute_asynccreates a cold, runtime-ownedDurableFuture; creation neither reserves a durable slot nor starts the callable.ctx.await(...)or Pythonawaitdelegates to the existing recovery state machine, which replays a terminal result, reconciles or re-executes a pending call, or reserves and executes a new call.ctx.gather(...)plans the complete ordered batch, reserves all required pending slots, and only then submits uncached calls.Key decisions
DurableFutureis an opaque, context-owned handle rather than ajava.util.concurrent.Future. Java waits go throughctx.await()so JDK 21 execution can yield through the runtime continuation instead of blocking withFuture.get().gatheraccepts only unique, unresolved single-call handles created by the same context. This prevents ambiguous slot ownership and reuse.Behavioral Semantics
awaitorgatherBehavioral contracts:
Outcome.failurevalues.InterruptedExceptionremains a cancellation signal in Java: it is propagated, the interrupt flag is restored, and interrupted/unstarted slots remain pending.asynciofutures.Tests
testDurableExecuteAsyncCreatesDeferredReusableHandle;test_flink_runner_context_async_future_is_deferred_and_reusabletestGatherReservesBatchBeforeExecutionAndCompletesChildren;test_flink_runner_context_gather_reserves_before_executionToolCallActiontests, including parallel business and infrastructure failuresVerified:
./tools/lint.sh --check../tools/build.sh --javaon JDK 17: all 35 modules built successfully with tests skipped.Not verified: external-service E2E execution, live Flink checkpoint recovery, and execution of the JDK 21 continuation path (compile-only in this environment).
Implementation invariants and evidence
API
This is a breaking pre-0.4 Java API change:
durableExecuteAsyncnow returnsDurableFuture<T>, and immediate callers migrate toctx.await(ctx.durableExecuteAsync(...)). Java addsawaitandgather, and removesdurableExecuteAllAsync.Python direct-await usage remains source-compatible. Python adds public
DurableFutureandctx.gather(...), removes publicDurableCall/AsyncExecutionResult, and removesdurable_execute_all_asyncin favor of composing single-call handles.Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)