Yep, your latest commit is exactly the approach I was thinking of, looks great! I don't think the messages session storage needs both options, its fine for it to just always store safe values in session regardless of which session serializer is in use. Minor unnecessary work when pickle serializer is used, but aren't we moving towards removing pickle serializer anyway? I think in general the approach we should be encouraging for the community is to generally store only simple data structures in the session.