Repository navigation
[runtime] Share execution identity across action state and graph calls - #1351
Merged
Merged
Conversation
Merged
2 of 5 tasks
Follow up PR apache#1342 with a shared causal identity utility for event occurrences and chat/subagent session and call allocation. Assign output identities before dispatch and preserve counters across suspension and cached-result replay. Persist occurrence metadata in ActionState JSON, remove content-only fallbacks and obsolete comments. Cover repeated identical triggers, multiple yields, explicit sessions, durable serialization and replay. Update direct runtime test fixtures to provide occurrence metadata explicitly. Validation: JDK 21 API/Plan/MCP/Runtime test reactor; clean JDK 11 focused regressions; Spotless and Apache RAT checks. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
wenjin272
force-pushed
the
codex/shared-execution-identity
branch
from
November 4, 2026 03:27
cadac8f to
9d2282b
Compare
wenjin272
marked this pull request as ready for review
November 4, 2026 03:27
2 of 5 tasks
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: #1084
Follow-up to #1342.
Purpose of change
Repeated equal-payload events in one input round must produce distinct chat/subagent calls as well as distinct durable action states. This follow-up applies the event occurrence identity to those calls and preserves it through suspension and recovery.
Runtime flow
RuntimeIdentityderives a root occurrence from the serialized business-key identity and input sequence, an Action execution ID from its triggering occurrence and action name, and an emitted occurrence from its producer execution and emission ordinal.ActionTaskContextManagerbinds the execution's emission counter and per-target call allocators toRunnerContextImplon each task switch or continuation transfer.Events receive identity before enqueueing, including subgraph bootstraps dispatched before their parent finishes. Completion-time memory observation and synthesized failure events receive identity before persistence/dispatch.
ActionStateSerdesaves occurrence metadata with both triggering and output events. Completed-action replay reuses those saved identities.Key decisions
Behavioral Semantics
Interaction decisions
Behavioral contracts
Distinct equal-payload occurrences produce distinct downstream execution and generated call identities. Repeating the same deterministic execution reproduces its identity sequence. Explicit sessions can be continued across executions without generated call-ID collisions. Durable serialization preserves event occurrence IDs; ordinary Event JSON continues to omit them.
Failure behavior
Missing occurrence metadata fails immediately rather than falling back to content. Ordinary Java emission rejects an event whose occurrence ID is already assigned. Negative emission ordinals are rejected. State serialization/deserialization errors continue to propagate through the existing durable-state failure handling. This change adds no retries or provider-error handling.
Tests
RuntimeIdentityIntegrationTest: chat/subagent, serial/parallel executionRuntimeIdentityTest,DeterministicIdAllocatorTest,BaseSubagentSetupTestChatDurableFutureTestActionStateSerdeTest,EventTestChatCallTest,InternalSubagentRecoveryTest,ActionStateDivergenceRecoveryTest, Kafka/Fluss recovery suitesActionStateUtilTest,RuntimeIdentityTestValidation after rebasing onto main with #1342 merged: clean JDK 21 API/MCP/Plan/Runtime reactor tests (3,080 tests, 81 skipped, no failures); clean JDK 11 focused regression build (189 tests, 19 skipped, no failures); Spotless and Apache RAT checks on a clean export of the committed tree.
Not verified: Python-only/cross-language E2E suites for this follow-up, external provider services, recovery across old/new ID formats. Deterministic emission/call order remains required; arbitrary user nondeterminism is not made replay-safe.
Implementation invariants and validation commands
The emission allocator belongs to a logical Action execution. RunnerContext holds the active reference; context transfer retains that reference and a fresh restarted execution constructs a new one. Length-prefixed hash components keep tuple boundaries unambiguous. Public Event JSON ignores occurrence metadata; the ActionState-specific Jackson mixin explicitly restores that property for durable serialization.
Targeted reactor builds use
mvn ... -pl runtime -amto rebuild local API, MCP, Plan and Runtime artifacts together. The JDK 21 full run used-Dtest=*Test,Test*; JDK switches usedcleanto remove continuation overlays. The clean JDK 11 run covered event JSON, runtime identity, call allocation, ActionState keys/serialization/divergence, context transfer, chat/subagent recovery and Python action execution.API
Public API signatures are unchanged. Internal identity utility/allocator signatures change. Root, emitted and generated call IDs change; no migration of old persisted keys or IDs is provided. Ordinary Java emission now rejects already-assigned Event instances. Java and Python calls use the shared runtime identity path; Python Event's JSON shape is unchanged.
Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Codex CLI 0.153.4 (GPT-6)