Skip to content

Return termination details from getResult - #3242

Open
pcbeingused33 wants to merge 2 commits into
temporalio:mainfrom
pcbeingused33:fix/terminated-failure-details
Open

pcbeingused33 wants to merge 2 commits into
temporalio:mainfrom
pcbeingused33:fix/terminated-failure-details

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

WorkflowStub.terminate stores its details on the workflow termination event, encoded with the workflow data converter. WorkflowStub.getResult built TerminatedFailure from the reason only, so those details were discarded. Cancellation already returns its details through EncodedValues and that same converter.

TerminatedFailure now carries the details, the same way CanceledFailure does. getResult reads them from the termination event and decodes them with the workflow converter. That converter is the workflow one even when a Nexus handler started the workflow and the server propagated a different context for the result. Terminate without details still leaves getDetails() empty. TerminatedFailureInfo has no details field, so failure protobuf conversion is unchanged.

There is no breaking change: TerminatedFailure(String, Throwable) stays as it is. No server change is required.

TerminatedWorkflowDetailsTest terminates a workflow with a detail large enough to be offloaded, through a prefix payload codec. Before this change that test did not compile, because TerminatedFailure had no getDetails(). With the change, ./gradlew --offline :temporal-sdk:test --tests io.temporal.workflow.TerminatedWorkflowDetailsTest --tests io.temporal.workflow.TerminatedWorkflowTest passes: the original detail and reason come back, the storage driver records a store and a retrieve, and terminate without details still yields an empty list. spotlessApply completed as well.

AI assistance was used to prepare this change.

WorkflowStub.terminate already encodes details with the workflow data
converter, but getResult built TerminatedFailure from the reason alone.
Pass the close-event details through that same converter, including a
payload codec and external payload storage.
@pcbeingused33
pcbeingused33 requested a review from a team as a code owner December 1, 2026 17:07
* @param reason optional reason for the termination request
* @param details additional details about the termination reason
* @param details additional details about the termination request. {@code getResult} exposes them
* on {@link TerminatedFailure#getDetails()}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment doesn't add any value, you already have docs on getDetails on TerminatedFailure

This branch has not been deployed

No deployments
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.

2 participants