Skip to content

[SDK Sentinel] Stabilize unfinished-handler cancellation test - #1824

Open
sdk-sentinel-bot wants to merge 1 commit into
temporalio:mainfrom
sdk-sentinel-forks:automation/sdk-sentinel/ci-flake/python/34293639283-1-5e3ec6599c50
Open

[SDK Sentinel] Stabilize unfinished-handler cancellation test#1824
sdk-sentinel-bot wants to merge 1 commit into
temporalio:mainfrom
sdk-sentinel-forks:automation/sdk-sentinel/ci-flake/python/34293639283-1-5e3ec6599c50

Conversation

@sdk-sentinel-bot

Copy link
Copy Markdown
Contributor

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-reproduction

  • Flake confidence: high
  • Fix confidence: high
  • Value: medium
  • Patch scope: standard — 1 changed file; 984 B
  • Local reproduction: not-reproduced — One pre-change focused execution of all 48 parameters passed; the CI race did not occur locally.
  • Regression coverage: pass-after-only — Existing parametrized coverage passed after the change, including 40 repeated cancellation/update cases; no fail-before reproduction was obtained.
  • Unchanged baseline (Poe lint, bridge lint, and editable build) — passed
  • Independent candidate (Poe lint, bridge lint, and editable build) — passed

Investigator-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

  • Continuous Integration / build-lint-test (3.14, macos-arm)

Residual risks

  • The stress check ran on Linux rather than the observed macOS runner.
  • Extreme server load could still expose a different workflow-task readiness failure.

Automation provenance

If this finding should not be fixed, apply the sdk-sentinel:false-positive label and close the PR. Sentinel will suppress the finding until its affected source changes.

SDK Sentinel recurrence history

  • Unique failed CI run attempts: 1
  • First occurrence: 2026-09-08 17:36 UTC
  • Latest occurrence: 2026-09-08 17:36 UTC
  • Recent occurrences:

@sdk-sentinel-bot
sdk-sentinel-bot requested a review from a team as a code owner September 9, 2026 01:05
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.

1 participant