Skip to content

[Bug] Replay workflow history fails with nondeterminism error, child workflow ids do not match #1790

@mishabruml

Description

@mishabruml

Related: #1582

What are you really trying to do?

I am trying to write a "workflow history compatibiltiy test" using Worker.runReplayHistory, so it can be run in CI to protect our team against accidentally introducing non-deterministic changes into our workflows.

Describe the bug

I am grabbing workflow history from a recent successful workflow run, pasting it as a JSON blob, and running a test like this:

import { Worker } from '@temporalio/worker';
import workflowHistory from './workflow-history.json';

describe('Workflow history compatibility', () => {
  test('Workflow history is compatible', async () => {
    await Worker.runReplayHistory(
      {
        workflowsPath: require.resolve('../workflow.ts'),
      },
      workflowHistory
    );
  });
});

The workflow contains several child workflows, for example:

  const child = executeChild(ChildWorkflow, {
    args: [childBody],
    taskQueue: QueueConfig.ChildWorkflow,
  });

When I run the test (locally), I get the following error:

DeterminismViolationError: Replay failed with a nondeterminism error. This means that the workflow code as written is not compatible with the history that was fed in. Details: Workflow activation completion failed: Failure { failure: Some(Failure { message: "[TMPRL1100] Nondeterminism error: Child workflow id of scheduled event '83ade076-5748-4685-b311-39985365e54c' does not match child workflow id of command '01324793-0653-4b87-ba22-639e2eaffe97'", source: "", stack_trace: "", encoded_attributes: None, cause: None, failure_info: Some(ApplicationFailureInfo(ApplicationFailureInfo { r#type: "", non_retryable: false, details: None, next_retry_delay: None, category: Unspecified })) }), force_cause: NonDeterministicError }

I have also tried modifying the workflow so that the child workflow executions start like this:

  import { uuid4 } from '@temporalio/workflow';

  const child = executeChild(ChildWorkflow, {
    args: [childBody],
    taskQueue: QueueConfig.ChildWorkflow,
    workflowId: uuid4(),
  });

And ran the workflow succesfully, grabbed the history from this run, and dropped that into my test- same outcome.

This seems like a bug, the child workflowId should not affect the determinism of the workflow run.

Environment/Versions

  • OS and processor: [e.g. Apple M2 Pro, Sequoia 5.6.1 (24G90)]
  • Temporal Version:
    "@temporalio/activity": "^1.11.1",
    "@temporalio/client": "^1.11.3",
    "@temporalio/common": "^1.11.2",
    "@temporalio/interceptors-opentelemetry": "^1.11.7",
    "@temporalio/nyc-test-coverage": "^1.11.2",
    "@temporalio/worker": "^1.11.1",
    "@temporalio/workflow": "^1.11.1",
  • Are you using Docker or Kubernetes or building Temporal from source? Docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions