elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

[BUG] WorkflowInput does not persist in Bookmark Callback

Open defunky opened this issue 9 months ago • 1 comments

Description

When assigning values in the WorkflowInput within ActivityExecutionContext within Execute methods either directly via activity or via starting workflow the WorkflowInput dictionary persists between each activity step. When an activity has a callback function via a Bookmark, accessing WorkflowInput within this callback is empty. The expected behaviour is to maintain the Workflow Inputs throughout the lifetime of the Workflow. I believe this might be because WorkflowInput can be set in the TriggerOption class in the ResumeWorkflow and when it's not set, it will initalise an empty Dictonary instead.

Steps to Reproduce

To help us identify the issue more quickly, please follow these guidelines:

Detailed Steps:

  1. Create two activities
  2. In first activity assign something to WorkflowInput within context inside of Execute method
  3. In the second activity assign additional element within WorkflowInput inside the Execute method
  4. You should have two elements when querying WorkflowInput in the second activity containing the elements you had specified
  5. In sceond activity create a bookmark with a callback
  6. Use IWorkflowRunTime and resume the workflow without specify any additional options
  7. Access WorkflowInput within the callback method
  8. WorkflowInput is empty and the elements assign previous are lost

Reproduction Rate: Everytime

Expected Behavior

The WorkflowInput within the bookmark callback should persist all values defined previous in the current execution of the workflow

Actual Behavior

WorkflowInput is empty and has no values, as a result losing all WorkflowInput values previously assigned

Environment

  • Elsa Package Version: 3.1

defunky avatar Apr 29 '24 22:04 defunky

Based on the provided context, it seems that you are experiencing an issue where the WorkflowInput dictionary is not persisting its values across different steps of the workflow, particularly after resuming from a bookmark. This behavior is unexpected as the WorkflowInput should maintain its state throughout the execution of the workflow.

This could potentially be a bug in the Elsa Workflow version you are using (3.1). The expected behavior is that the WorkflowInput should be accessible and should retain all the values that were previously set during the workflow execution, even after resuming from a bookmark.

To address this issue, you should:

  1. Ensure that you are using the latest version of Elsa Workflow, as this might be a bug that has been fixed in a newer release.
  2. Review the documentation to confirm that your implementation aligns with the expected usage patterns for WorkflowInput.
  3. Check the Elsa GitHub issues and discussions to see if this is a known issue and if there are any suggested workarounds or fixes.
  4. If the issue persists and is not addressed in the documentation or GitHub issues, consider reporting this behavior as a bug on the Elsa GitHub repository.

In the meantime, as a workaround, you might consider manually persisting the WorkflowInput values across bookmarks by using a custom persistence mechanism or by storing the values in a database or cache that can be accessed after resuming the workflow.

Please let me know if you need further assistance or if there are any specific details you would like to know regarding this issue.

This comment was generated by Glime.

glime-ai[bot] avatar Apr 29 '24 22:04 glime-ai[bot]