Fix TestWorkflowStartConflict flaky test#9776
Merged
Conversation
stephanos
approved these changes
Apr 1, 2026
…-with-start-failure
a8bf294 to
ecb44ba
Compare
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.
What changed?
Fix flaky test
TestUpdateWithStartSuite/TestWorkflowStartConflict/workflow_id_conflict_policy_fail:_use-existinghandling both possible orderings of the race condition it tests.Why?
The test injects a hook (
UpdateWithStartInBetweenLockAndStart) that fires a concurrentStartWorkflowExecutionbetween the update-with-start lock acquisition and start attempt to simulate a race condition. The test assumes the update always lands in a second speculative WFT:This assumption broke after the
parallelsuitemigration, which gives each test its own isolatedtestcore.NewEnvrunning in parallel. With a dedicated env, the retryable history client's immediate retry of the Unavailable error races tightly withRecordWorkflowTaskStarted:The original two-poll design panicked in ordering A (index out of range [0] with length 0 on task.Messages[0] in the empty-response first poll). The initial single-poll fix panicked in ordering B for the same reason. Neither ordering is
guaranteed, so the test must handle both.
How did you test it?
-count=50locallyPotential risks
None, test only