Add reset options to the ResetWorkflowExecution rpc #693
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.
READ BEFORE MERGING: All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted.
What changed?
Per temporalio/temporal#1338:
Originally, I planned on addressing this by adding the
reset_typedescribed in that ticket and utilized in the CLI. However, after starting implementation, I found the batch operations already usesResetOptions(see BatchOperationReset), which provides a more flexible and extensible solution.If applied, this PR will add a
reset_optionsfield toResetWorkflowExecutionRequest- This allows callers to specify reset targets (first/last workflow task, build ID, etc.) without needing to compute exact event IDs, bringing the same capabilities to single-workflow resets that batch operations already have.Why?
This moves the reset point determination logic from the CLI into the service, enabling SDKs to perform user-friendly reset operations like "reset to the first workflow task" without implementing their own history traversal logic.
Breaking changes
Fully backwards compatible.
workflow_task_finish_event_idfield remains unchanged and functionalreset_optionsis set, it takes precedence overworkflow_task_finish_event_idBatchOperationReset, which has both options and deprecated legacy fieldsServer PR
As I understand it, this does not break the Server. However, if reset options are supplied in the modified gRPC request, they will be ignored.
Next steps
Server-side implementation will need to handle the new
reset_optionsfield by:reset_optionsis set and using it to determine the reset pointworkflow_task_finish_event_idifreset_optionsis not seta. I haven't confirmed this, but I'd imagine I could copy the logic from the batch operations.