Summary
The WorkflowExecutor stores execution contexts in a dictionary. Note: Python dicts ARE thread-safe for individual operations (due to the GIL). The real question is whether there are async race conditions - multiple coroutines interleaving at await points that could cause logical issues.
Files
| File |
Line |
_workflow_executor.py |
383 |
Context
# TODO check thread safety (clean up throughout ...) or declare not thread safe
self._execution_contexts[execution_id] = execution_context
Clarification needed:
- Can two async coroutines access the same
execution_id concurrently?
- Are there compound "check-then-act" patterns that could race between
await points?
- If two writes to the same key occur, is "last write wins" acceptable?
The _execution_contexts dict is accessed when:
- Starting sub-workflow executions
- Handling response messages
- Cleaning up completed executions
- Checkpoint save/restore operations
Action Items
Summary
The
WorkflowExecutorstores execution contexts in a dictionary. Note: Python dicts ARE thread-safe for individual operations (due to the GIL). The real question is whether there are async race conditions - multiple coroutines interleaving atawaitpoints that could cause logical issues.Files
_workflow_executor.pyContext
Clarification needed:
execution_idconcurrently?awaitpoints?The
_execution_contextsdict is accessed when:Action Items
execution_idis possibleasyncio.Lock, or document that it is safe by design