Skip to content

Preserve Nexus start-to-close timeout after deferred cancellation - #12043

Open
Qian-Cheng-nju wants to merge 1 commit into
temporalio:mainfrom
Qian-Cheng-nju:fix/nexus-deferred-cancel-timeout
Open

Qian-Cheng-nju wants to merge 1 commit into
temporalio:mainfrom
Qian-Cheng-nju:fix/nexus-deferred-cancel-timeout

Conversation

@Qian-Cheng-nju

Copy link
Copy Markdown

What changed?

When a Nexus operation starts after cancellation was requested, schedule the deferred cancellation transition and then continue the parent operation transition so it also emits the configured start-to-close timeout task.

The state-machine regression test verifies that the transition emits the timeout task. The functional test blocks the Nexus start response, requests cancellation, then verifies both cancellation delivery and the eventual NEXUS_OPERATION_TIMED_OUT history event. It pins the legacy HSM implementation that contains this transition.

Why?

When cancellation is requested while a Nexus start call is still in flight and that call later returns an asynchronous operation, Temporal can omit the configured start-to-close timeout and leave the operation pending past its deadline. service/history/hsm/nexusoperations/statemachine_test.go reproduces this transition order and observes that no start-to-close timeout task is emitted, leaving the operation without its configured deadline.

The started transition returned immediately after scheduling deferred cancellation, before it emitted the timeout task. Cancellation acknowledgement alone does not complete the operation.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Commands:

go test -tags test_dep -p 4 ./service/history/hsm/nexusoperations -count=1
go test -tags test_dep -p 4 ./tests -run '^TestNexusOperationStartToCloseTimeoutAfterDeferredCancellation$' -count=3
make lint-code-fast

The state-machine regression assertion failed on the base revision with zero timeout tasks. It passes with this change, and the functional scenario passed three consecutive runs.

Potential risks

This adds the normal start-to-close timer to the deferred-cancellation path. Existing task validation rejects the timer if the operation is no longer started when it fires.

@Qian-Cheng-nju
Qian-Cheng-nju requested review from a team as code owners September 12, 2026 13:52
@CLAassistant

CLAassistant commented Sep 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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