elsa-workflows / elsa-workflows/elsa-core
Issues with Persisting and Reading Workflow Input Variables
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
When starting a workflow, it is possible to pass a set of variables that can then be accessed by activities within the workflow. However, there are two key issues affecting the handling of these variables:
1. **Lack of Storage Driver for Input Variables**
- There is no way to configure input variables with a storage driver.
- As a result, variable values are lost when the workflow instance is suspended or completed and removed from memory.
- This is particularly problematic for long-running workflows, where variables need to persist across suspension points.
2. **Bug in `IWorkflowInstanceVariableReader` for Dynamic Variables**
- When using the `IWorkflowInstanceVariableReader` service to read variables from a workflow instance, dynamic variables are not properly considered.
- The service only accounts for predefined workflow variables defined at the workflow definition level.
- Dynamic variables stored in the root activity execution context are ignored, preventing their retrieval.
### Expected Behavior
- Input variables should be storable using a configurable storage driver to ensure persistence across workflow suspension points.
- `IWorkflowInstanceVariableReader` should be able to read both predefined and dynamic variables from the workflow instance.
### Steps to Reproduce
1. Start a workflow and pass a set of input variables.
2. Suspend or complete the workflow instance.
3. Attempt to access the variables after resuming the workflow.
4. Observe that the variables are lost.
5. Use `IWorkflowInstanceVariableReader` to read a dynamic variable from the workflow instance.
6. Observe that only predefined variables are retrieved, while dynamic variables are ignored.
### Suggested Fix
- Implement a configurable storage mechanism for input variables to persist them beyond in-memory execution.
- Update `IWorkflowInstanceVariableReader` to consider dynamic variables stored in the root activity execution context.
### Environment
- Elsa Workflows Version: 3.3
Contributor guide
Research direction
Start by locating IWorkflowInstanceVariableReader and the workflow input-variable persistence paths in the Elsa Workflows 3.3 codebase. Trace how variables are stored across suspension and how the reader resolves predefined versus dynamic variables; done means configurable persistence works after suspension and dynamic root-context variables are returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100