Convert Nexus completion tokens across HSM and CHASM#11035
Draft
tekkaya wants to merge 1 commit into
Draft
Conversation
5 tasks
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
from
July 14, 2026 06:04
fa93a90 to
14ec28b
Compare
tekkaya
changed the base branch from
gokhan/nexus-completion-run-fallback
to
gokhan/nexus-operation-identity
July 14, 2026 06:04
tekkaya
force-pushed
the
gokhan/nexus-operation-identity
branch
from
July 14, 2026 08:35
e7e6ff4 to
498c4d4
Compare
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
from
July 14, 2026 08:35
14ec28b to
d989a8f
Compare
tekkaya
force-pushed
the
gokhan/nexus-operation-identity
branch
from
July 14, 2026 08:59
498c4d4 to
06fe036
Compare
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
from
July 14, 2026 09:00
d989a8f to
117fcc4
Compare
tekkaya
force-pushed
the
gokhan/nexus-operation-identity
branch
from
July 14, 2026 10:08
06fe036 to
0a0aeed
Compare
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
2 times, most recently
from
July 14, 2026 11:37
c379b04 to
f2c682e
Compare
tekkaya
force-pushed
the
gokhan/nexus-operation-identity
branch
2 times, most recently
from
July 16, 2026 09:08
d37e756 to
ddd4a7d
Compare
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
from
July 16, 2026 09:16
f2c682e to
c053720
Compare
tekkaya
force-pushed
the
gokhan/nexus-operation-identity
branch
from
July 16, 2026 09:28
ddd4a7d to
0d324bd
Compare
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
2 times, most recently
from
July 16, 2026 15:00
b6c8681 to
c7f1809
Compare
tekkaya
force-pushed
the
gokhan/nexus-operation-identity
branch
from
July 16, 2026 19:19
0d324bd to
a8b917e
Compare
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
from
July 16, 2026 19:19
c7f1809 to
7cc6148
Compare
tekkaya
added a commit
that referenced
this pull request
Jul 17, 2026
## What changed? Adds a top-level `nexusworkflowref` package exposing two functions that convert a Nexus operation completion token between its HSM and CHASM forms: - `HSMRefToCHASMRef` — HSM `StateMachineRef` token → CHASM `ChasmComponentRef` token - `CHASMRefToHSMRef` — the reverse Both directions rebuild the target framework's ref from the fields shared by the two representations (namespace, workflow, run, scheduled event ID, request ID). `CHASMRefToHSMRef` only accepts workflow-backed operations: it verifies the ref's `WorkflowArchetypeID` and its `["Operations", "<scheduledEventID>"]` component path before converting. ## Why? Preparation for the cross-framework Nexus completion fallback (#11035), where a completion whose token targets one framework must be retried against the other after a rebuild (reset or conflict resolution) flips the operation's framework. ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s) ## Potential risks Low — additive, and only invoked by #11035. The one coupling to watch: the converter encodes the CHASM `Operations` map field name and `WorkflowArchetypeID`; a change to the workflow component's layout must be reflected here.
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
2 times, most recently
from
July 17, 2026 08:45
d901982 to
59e28af
Compare
davidporter-id-au
pushed a commit
to davidporter-id-au/temporal
that referenced
this pull request
Jul 17, 2026
## What changed? Adds a top-level `nexusworkflowref` package exposing two functions that convert a Nexus operation completion token between its HSM and CHASM forms: - `HSMRefToCHASMRef` — HSM `StateMachineRef` token → CHASM `ChasmComponentRef` token - `CHASMRefToHSMRef` — the reverse Both directions rebuild the target framework's ref from the fields shared by the two representations (namespace, workflow, run, scheduled event ID, request ID). `CHASMRefToHSMRef` only accepts workflow-backed operations: it verifies the ref's `WorkflowArchetypeID` and its `["Operations", "<scheduledEventID>"]` component path before converting. ## Why? Preparation for the cross-framework Nexus completion fallback (temporalio#11035), where a completion whose token targets one framework must be retried against the other after a rebuild (reset or conflict resolution) flips the operation's framework. ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s) ## Potential risks Low — additive, and only invoked by temporalio#11035. The one coupling to watch: the converter encodes the CHASM `Operations` map field name and `WorkflowArchetypeID`; a change to the workflow component's layout must be reflected here.
A rebuild (reset or conflict resolution) can re-create a Nexus operation under the other framework (HSM<->CHASM) by dynamic config after its callback token was minted, leaving the token addressing the framework the operation no longer lives in, so the completion is lost. The frontend completion dispatcher now, on a NotFound from the token's framework, converts the token to the other framework and retries once. The conversion routes through framework-owned identity helpers via the shared nexus.OperationIdentity, so the frontend does not parse either framework's ref layout. Identity is re-established by request ID, matching the completion handlers' reset fallback. The HSM->CHASM direction is gated on the namespace having CHASM enabled (a CHASM-disabled namespace has no CHASM tree, so the conversion would be futile); CHASM->HSM is always safe since HSM is the legacy default. Adds a dispatcher-fallback unit test and a functional test that completes an operation after a rebuild flips its framework in both directions.
tekkaya
force-pushed
the
gokhan/nexus-completion-token-conversion
branch
from
July 19, 2026 11:18
59e28af to
6125185
Compare
tekkaya
changed the base branch from
main
to
gokhan/nexus-completion-run-fallback
July 19, 2026 11:18
This was referenced Jul 19, 2026
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.
What changed?
On a
NotFoundfrom the framework a Nexus completion token targets, the frontend completion dispatcher now converts the token to the other framework (HSM ↔ CHASM) and retries once. This handles the rebuild escape hatch: a reset/conflict-resolution can re-create an operation under the other framework by dynamic config after its callback token was minted, leaving the token addressing the framework the operation no longer lives in.Conversion routes through the
nexusworkflowrefpackage added in #11050 (HSMRefToCHASMRef/CHASMRefToHSMRef). The scheduled event ID is the join key; versioned transitions are not carried across — identity is re-established by request ID, matching the completion handlers' reset fallback. The HSM→CHASM direction is gated on the namespace having CHASM enabled (a CHASM-disabled namespace has no CHASM tree); CHASM→HSM is always attempted since HSM is the legacy default and returns a cleanNotFoundwhen absent.Why?
Mirrors the reset reapply's cross-tree routing (#10986) at the live-completion layer — that PR's TODO explicitly flagged that "the completion-token resolution path (HSM StateMachineRef vs CHASM ComponentRef) also needs the same fallback." Without it, an async completion for an operation whose framework was flipped by a rebuild never lands.
How did you test it?
Functional:
TestNexusOperationAsyncCompletionAfterFrameworkFlipcompletes an operation after a rebuild flips its framework in both directions, validated end-to-end in an integration branch with the reset stack applied.Potential risks
Stacked on #11028 (run fallback), which is based on
main. The nexusworkflowref package (#11050) and the reset stack (#10986, #10983) that produces the framework flip have merged, so #11028 is the only remaining dependency — the CHASM completion handler needs itsComponentCreation/CurrentRunfallback to resolve the converted (versioned-transition-less) token. With #11028 in the stack the functional test passes end-to-end (both flip directions). Kept as a draft until #11028 merges; GitHub retargets this PR tomainat that point.