Activity replay does not work

Hi All,
I want the completed workflow to be replayed…Workflow body works fine but the activities do not start.
Before, I started the standard workflow;
OUTPUT:
BODY START ====>
ACTIVITY START====>
After,I replayed completed workflow. “ACTIVITY START====>” not printed.

OUTPUT:
BODY START ====>

func Workflow(ctx workflow.Context, name string) error {
fmt.Println("BODY START ====> ")

err := workflow.ExecuteActivity(ctx, Activity, name).Get(ctx, nil)


func Activity(ctx context.Context, name string) error {
fmt.Println("ACTIVITY START====> ")

Why is the activity not starting?
Thanks.

want the completed workflow to be replayed,
After,I replayed completed workflow

Can you give more info here? Are you starting the workflow execution again from client?

Share event history for this execution (where you say activity execution is not done):

tctl wf show -w <wfid> -r <runid> --of myhistory.json

(share json in myhistory.json here)

Hi again,
Yes,I am starting the workflow execution again from client.
I get this example from samples-go based repo but hello.Workflow is custom.
History event is below.
Thanks,

replayer := worker.NewWorkflowReplayer()
replayer.RegisterWorkflow(hello.Workflow)
execution := workflow.Execution{ID: "multiple-history-replay", RunID: "8aa316c1-8eb5-4d01-80c5-2e5e39a0a360"}
err = replayer.ReplayWorkflowExecution(ctx, c.WorkflowService(), nil, "default", execution)

Event history

{
  "events": [
    {
      "eventId": "1",
      "eventTime": "2023-03-21T12:43:38.474168339Z",
      "eventType": "WorkflowExecutionStarted",
      "version": "0",
      "taskId": "1048666",
      "workerMayIgnore": false,
      "workflowExecutionStartedEventAttributes": {
        "workflowType": {
          "name": "Workflow"
        },
        "parentWorkflowNamespace": "",
        "parentWorkflowNamespaceId": "",
        "parentWorkflowExecution": null,
        "parentInitiatedEventId": "0",
        "taskQueue": {
          "name": "multiple-history-replay",
          "kind": "Normal"
        },
        "input": {
          "payloads": [
            {
              "metadata": {
                "encoding": "anNvbi9wbGFpbg=="
              },
              "data": "IlRlbXBvcmFsIg=="
            }
          ]
        },
        "workflowExecutionTimeout": "0s",
        "workflowRunTimeout": "0s",
        "workflowTaskTimeout": "10s",
        "continuedExecutionRunId": "",
        "initiator": "Unspecified",
        "continuedFailure": null,
        "lastCompletionResult": null,
        "originalExecutionRunId": "8aa316c1-8eb5-4d01-80c5-2e5e39a0a360",
        "identity": "58855@tarikguven.local@",
        "firstExecutionRunId": "8aa316c1-8eb5-4d01-80c5-2e5e39a0a360",
        "retryPolicy": null,
        "attempt": 1,
        "workflowExecutionExpirationTime": null,
        "cronSchedule": "",
        "firstWorkflowTaskBackoff": "0s",
        "memo": null,
        "searchAttributes": null,
        "prevAutoResetPoints": null,
        "header": {
          "fields": {}
        },
        "parentInitiatedEventVersion": "0"
      }
    },
    {
      "eventId": "2",
      "eventTime": "2023-03-21T12:43:38.474520631Z",
      "eventType": "WorkflowTaskScheduled",
      "version": "0",
      "taskId": "1048667",
      "workerMayIgnore": false,
      "workflowTaskScheduledEventAttributes": {
        "taskQueue": {
          "name": "multiple-history-replay",
          "kind": "Normal"
        },
        "startToCloseTimeout": "10s",
        "attempt": 1
      }
    },
    {
      "eventId": "3",
      "eventTime": "2023-03-21T12:43:38.500890548Z",
      "eventType": "WorkflowTaskStarted",
      "version": "0",
      "taskId": "1048672",
      "workerMayIgnore": false,
      "workflowTaskStartedEventAttributes": {
        "scheduledEventId": "2",
        "identity": "58831@tarikguven.local@",
        "requestId": "bed07c03-7783-4931-bc0c-53f4cda2a4c9",
        "suggestContinueAsNew": false,
        "historySizeBytes": "289"
      }
    },
    {
      "eventId": "4",
      "eventTime": "2023-03-21T12:43:38.511854923Z",
      "eventType": "WorkflowTaskCompleted",
      "version": "0",
      "taskId": "1048676",
      "workerMayIgnore": false,
      "workflowTaskCompletedEventAttributes": {
        "scheduledEventId": "2",
        "startedEventId": "3",
        "identity": "58831@tarikguven.local@",
        "binaryChecksum": "c4ea76e928ac8f2eab01e9860bdb78a2",
        "workerVersioningId": null
      }
    },
    {
      "eventId": "5",
      "eventTime": "2023-03-21T12:43:38.511954089Z",
      "eventType": "ActivityTaskScheduled",
      "version": "0",
      "taskId": "1048677",
      "workerMayIgnore": false,
      "activityTaskScheduledEventAttributes": {
        "activityId": "5",
        "activityType": {
          "name": "Activity"
        },
        "taskQueue": {
          "name": "multiple-history-replay",
          "kind": "Normal"
        },
        "header": {
          "fields": {}
        },
        "input": {
          "payloads": [
            {
              "metadata": {
                "encoding": "anNvbi9wbGFpbg=="
              },
              "data": "IlRlbXBvcmFsIg=="
            }
          ]
        },
        "scheduleToCloseTimeout": "0s",
        "scheduleToStartTimeout": "0s",
        "startToCloseTimeout": "10s",
        "heartbeatTimeout": "0s",
        "workflowTaskCompletedEventId": "4",
        "retryPolicy": {
          "initialInterval": "1s",
          "backoffCoefficient": 2,
          "maximumInterval": "60s",
          "maximumAttempts": 1,
          "nonRetryableErrorTypes": [
            "MyError"
          ]
        }
      }
    },
    {
      "eventId": "6",
      "eventTime": "2023-03-21T12:43:38.518051964Z",
      "eventType": "ActivityTaskStarted",
      "version": "0",
      "taskId": "1048683",
      "workerMayIgnore": false,
      "activityTaskStartedEventAttributes": {
        "scheduledEventId": "5",
        "identity": "58831@tarikguven.local@",
        "requestId": "6d6291d9-b5ec-4faf-8fa4-0786204aaab0",
        "attempt": 1,
        "lastFailure": null
      }
    },
    {
      "eventId": "7",
      "eventTime": "2023-03-21T12:43:38.525704839Z",
      "eventType": "ActivityTaskCompleted",
      "version": "0",
      "taskId": "1048684",
      "workerMayIgnore": false,
      "activityTaskCompletedEventAttributes": {
        "result": null,
        "scheduledEventId": "5",
        "startedEventId": "6",
        "identity": "58831@tarikguven.local@"
      }
    },
    {
      "eventId": "8",
      "eventTime": "2023-03-21T12:43:38.525715673Z",
      "eventType": "WorkflowTaskScheduled",
      "version": "0",
      "taskId": "1048685",
      "workerMayIgnore": false,
      "workflowTaskScheduledEventAttributes": {
        "taskQueue": {
          "name": "tarikguven.local:d8e52492-c85e-403b-866a-68bf94af64fb",
          "kind": "Sticky"
        },
        "startToCloseTimeout": "10s",
        "attempt": 1
      }
    },
    {
      "eventId": "9",
      "eventTime": "2023-03-21T12:43:38.531223923Z",
      "eventType": "WorkflowTaskStarted",
      "version": "0",
      "taskId": "1048689",
      "workerMayIgnore": false,
      "workflowTaskStartedEventAttributes": {
        "scheduledEventId": "8",
        "identity": "58831@tarikguven.local@",
        "requestId": "f0465973-1a6e-4a98-aaa2-df152cba9126",
        "suggestContinueAsNew": false,
        "historySizeBytes": "869"
      }
    },
    {
      "eventId": "10",
      "eventTime": "2023-03-21T12:43:38.539543006Z",
      "eventType": "WorkflowTaskCompleted",
      "version": "0",
      "taskId": "1048693",
      "workerMayIgnore": false,
      "workflowTaskCompletedEventAttributes": {
        "scheduledEventId": "8",
        "startedEventId": "9",
        "identity": "58831@tarikguven.local@",
        "binaryChecksum": "c4ea76e928ac8f2eab01e9860bdb78a2",
        "workerVersioningId": null
      }
    },
    {
      "eventId": "11",
      "eventTime": "2023-03-21T12:43:38.539570173Z",
      "eventType": "WorkflowExecutionCompleted",
      "version": "0",
      "taskId": "1048694",
      "workerMayIgnore": false,
      "workflowExecutionCompletedEventAttributes": {
        "result": null,
        "workflowTaskCompletedEventId": "10",
        "newExecutionRunId": ""
      }
    }
  ]
}

replayer := worker.NewWorkflowReplayer()
Yes,I am starting the workflow execution again from client.

Ok so when you see your activities not being executed, is that when you run your test using WorkflowReplayer? WorkflowReplayer simulates internal workflow code replay and already executed activities (based on your event history) would not be invoked during this replay.
Trying to understand how the WorkflowReplayer code you shared is related to “starting the workflow execution again from client”.

No, the Activity worked fine the first time it was run (event id=7). It didn’t work when “replay”.Because it didn’t print the “activity” output. But the “workflow” body printed its output.
Thanks.