Skip to content

fix: small nil-check for schedules during migration#10725

Draft
davidporter-id-au wants to merge 2 commits into
temporalio:mainfrom
davidporter-id-au:bugfix/scheduler-migration-nil-completion
Draft

fix: small nil-check for schedules during migration#10725
davidporter-id-au wants to merge 2 commits into
temporalio:mainfrom
davidporter-id-au:bugfix/scheduler-migration-nil-completion

Conversation

@davidporter-id-au

@davidporter-id-au davidporter-id-au commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

CreateSchedulerFromMigration stored whatever LastCompletionResult the migrated V1 state carried, which is nil when the schedule had no prior completion (e.g. migrated before its first action) — convertLastCompletionLegacyToCHASM returns nil in that case. InvokerExecuteTaskHandler.startWorkflow then dereferences lastCompletionState.Success/.Failure unconditionally, panicking on the first workflow start after migration.

The normal CreateScheduler/NewScheduler path defaults to a non-nil empty &schedulerpb.LastCompletionResult{}, so it never hit this. This change defaults to the same non-nil empty value in CreateSchedulerFromMigration.

How found

Surfaced by the V2→V1→V2 migration round-trip test (top of the stack below).

Stack

This is the base of a stack of scheduler test-coverage PRs (review in order):

  1. this PR — production fix
  2. chasm-scheduler-test-harness
  3. chasm-scheduler-invariants
  4. chasm-scheduler-property-tests / chasm-scheduler-migration-roundtrip (siblings)

Test plan

  • go build ./chasm/lib/scheduler/...
  • Covered end-to-end by the migration round-trip test in the stack.

CreateSchedulerFromMigration stored whatever LastCompletionResult the migrated
V1 state carried, which is nil when the schedule had no prior completion (e.g.
migrated before its first action) — convertLastCompletionLegacyToCHASM returns
nil in that case. InvokerExecuteTaskHandler.startWorkflow then dereferences
lastCompletionState.Success/.Failure unconditionally, panicking on the first
workflow start after migration.

The normal CreateScheduler/NewScheduler path defaults to a non-nil empty
&schedulerpb.LastCompletionResult{}, so it never hit this. Default to the same
non-nil empty value in CreateSchedulerFromMigration.

Found by the V2->V1->V2 migration round-trip test.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
(cherry picked from commit 23ad378b19a638df2603c47c0e3a806e9877bf2e)
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