The current design for how we get a StatefulWorkflow from the StatelessWorkflow is a failed compromise between performance (caching) and type-safe brevity (erasing the StateT type from the concerns of StatelessWorkflow). It needs to be fixed with a bigger re-write.
As a clear example of its failure. Right now we cache the RenderContext in the instance of the StatelessAsStatefulWorkflow inner class. This same instance is re-used by any and all uses of the underlying StatelessWorkflow in the workflow tree, meaning that the RenderContext will need to be re-created every time it is used again in the tree as there will be a new RenderContext created by the new session/node.
So the caching only really works when we use it once and only once, otherwise it is still re-created each time in render() since we compare with instance equality !==.