Repository navigation
[SDK Sentinel] Fix time-skipping external cancel test race - #2027
Open
sdk-sentinel-bot wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Prevent the external-workflow cancellation test from racing its target timer. The failure appeared in the [macOS ARM time-skipping V2 job](https://github.com/temporalio/sdk-python/actions/runs/40522868526/job/122254383729). The [preceding main CI](https://github.com/temporalio/sdk-python/actions/runs/40519296785) passed, while the [first captured bad CI](https://github.com/temporalio/sdk-python/actions/runs/40522868526) failed with unchanged relevant code.
Root cause
The target used a 1000-second workflow timer. Time-skipping V2 can advance that timer before the separate cancellation workflow sends its request, letting the target complete normally instead of raising cancellation.
Fix
Use the existing timer-free wait-forever workflow as the target. External cancellation is now its only completion path, removing the nondeterministic ordering.
Validation
The failure did not reproduce in 50 pre-change stress iterations. With the fix, 100 time-skipping V2 iterations and one normal-environment run passed. The fixed repository validator and unchanged baseline passed. macOS ARM CI remains required.
Validation status:
validated-without-reproductionhighhighmediumstandard— 1 changed file; 1.4 KiBnot-reproduced— Fifty pre-change Linux time-skipping V2 stress iterations passed; the captured scheduling race did not occur locally.pass-after-only— The existing focused test passed 100 time-skipping V2 stress iterations and one normal-environment iteration after the candidate.Poe lint, bridge lint, and editable build) — passedPoe lint, bridge lint, and editable build) — passedInvestigator-run checks
poe test -s --workflow-environment time-skipping-v2 tests/worker/test_workflow.py::test_workflow_cancel_external --flake-finder --flake-runs 50— passed; 50 attempt(s). Before the edit, all 50 iterations passed, so natural local reproduction was not obtained.poe test -s --workflow-environment time-skipping-v2 tests/worker/test_workflow.py::test_workflow_cancel_external --flake-finder --flake-runs 100— passed; 100 attempt(s). All 100 iterations passed with the final candidate on Linux.poe test -s --workflow-environment local tests/worker/test_workflow.py::test_workflow_cancel_external— passed; 1 attempt(s). The timer-free target preserved normal local-environment cancellation behavior..ci-flake-runtime/input/validate.sh— passed; 1 attempt(s). The fixed validator passed formatting, imports, type checks, docstyle, Rust clippy, and editable bridge build. The trusted unchanged baseline also passed.Required target CI
Residual risks
Automation provenance
64b700540a14591f7bfcfebeaad2dfc5ba9cce1bIf 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-10-27 14:55 UTC2026-10-27 14:55 UTC