fix: deduplicate state during V1-to-V2 schedule migration#9725
Merged
chaptersix merged 4 commits intotemporalio:mainfrom Apr 6, 2026
Merged
Conversation
V1's recordAction puts the same workflow in both RunningWorkflows and RecentActions. When migrating to CHASM, both lists were independently converted to BufferedStarts and concatenated, creating duplicate entries for the same workflow execution with different RequestIds. The running entry would later get updated via Nexus callback (COMPLETED), but the stale duplicate from RecentActions retained its original RUNNING status, causing the UI to show the same workflow twice with conflicting statuses. Filter out RecentActions entries whose RunId matches a RunningWorkflows entry during V1-to-V2 conversion, since those are already handled by convertRunningWorkflowsToBufferedStarts.
When multiple workflows are running concurrently (ALLOW_ALL overlap policy), convertRunningWorkflowsToBufferedStarts generated identical RequestIds for all of them because the only differentiating inputs (nominal/actual time) were both set to migrationTime. Include the RunId in the backfillID tag parameter so each running workflow gets a distinct RequestId. Without this, recordCompletedAction would match the first BufferedStart for every completion callback, misattributing completions.
CreateSchedule with EnableChasm=true writes a CHASM sentinel that blocks the subsequent migration activity with a NotFound error due to a cache invalidation race in the CHASM engine. Enable CHASM only after the V1 schedule is created and the running workflow is recorded.
lina-temporal
approved these changes
Apr 3, 2026
Closed
3 tasks
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.
Summary
Fixes two bugs in the V1-to-V2 (CHASM) schedule migration that produce corrupt
RecentActionsstate:Duplicate RecentActions entries. V1's
recordActionputs the same workflow in bothRunningWorkflowsandRecentActions. The migration converted both lists independently intoBufferedStartentries and concatenated them, creating two entries for the same workflow execution.Identical RequestIds for concurrent running workflows.
convertRunningWorkflowsToBufferedStartsgenerated the same deterministicRequestIdfor every running workflow (all inputs were identical). WithALLOW_ALLoverlap policy, multiple workflows can be running at migration timeChanges
convertRecentActionsToBufferedStartsnow filters out entries whoseRunIdmatches aRunningWorkflowsentry, since those are already converted byconvertRunningWorkflowsToBufferedStarts.convertRunningWorkflowsToBufferedStartsnow includes theRunIdin thebackfillIDtag parameter toGenerateRequestID, ensuring each running workflow gets a unique RequestId.