[SDK Sentinel] Stabilize unfinished-handler cancellation test - #1824
Merged
Conversation
tconley1428
approved these changes
Sep 9, 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.
Caution
This PR contains untrusted AI-generated code. Do not approve or run CI until a maintainer has reviewed the diff. SDK Sentinel verified that GitHub Actions remained approval-gated with zero executable jobs when this PR was opened.
Summary
Stabilize the unfinished-handler cancellation test after the [first captured macOS failure](https://github.com/temporalio/sdk-python/actions/runs/34256407686/job/102163229591) and a [corroborating failure](https://github.com/temporalio/sdk-python/actions/runs/34262268385/job/102195905654). No equivalent last-known-good run was included in the snapshot.
Root cause
The setup requested cancellation before starting the update. Server scheduling could advance cancellation first, leaving the update RPC to observe a failed workflow task instead of joining the workflow task that the test intends to exercise.
Fix
Queue the update or signal first, wait until it is accepted, then request cancellation before starting the worker. This preserves the intended shared-workflow-task scenario while removing nondeterministic request ordering.
Validation
The pre-change focused run did not reproduce the failure. After the change, all 48 focused parameters passed, as did 40 repeated cancellation/update cases. The canonical lint, type, bridge-lint, and editable-build validator passed. macOS Python 3.14 CI remains required because local validation ran on Linux.
Validation status:
validated-without-reproductionhighhighmediumstandard— 1 changed file; 984 Bnot-reproduced— One pre-change focused execution of all 48 parameters passed; the CI race did not occur locally.pass-after-only— Existing parametrized coverage passed after the change, including 40 repeated cancellation/update cases; no fail-before reproduction was obtained.Poe lint, bridge lint, and editable build) — passedPoe lint, bridge lint, and editable build) — passedInvestigator-run checks
poe test -s -k test_unfinished_handler_on_workflow_termination— passed; 2 attempt(s). All 48 parameters passed before and after the change; the pre-change run did not naturally reproduce the flake.poe test -s -k 'test_unfinished_handler_on_workflow_termination and cancellation and update' --flake-finder --flake-runs=5— passed; 1 attempt(s). All 40 post-change cancellation/update stress cases passed..ci-flake-runtime/input/validate.sh— passed; 1 attempt(s). Ruff, Pyright, mypy, basedpyright, pydocstyle, bridge Clippy, and editable bridge build passed.Required target CI
Residual risks
Automation provenance
ee2a4da7b075b96e574d4388d27f61fb9d205ab8If this finding should not be fixed, apply the
sdk-sentinel:false-positivelabel and close the PR. Sentinel will suppress the finding until its affected source changes.SDK Sentinel recurrence history
2026-09-08 17:36 UTC2026-09-08 17:36 UTC