Awesome! Thanks mike. That's exactly what I needed.
After several hours of debugging, I finally tracked down the issue - which solved at least 4 outstanding bugs, and let me clear out a bunch of code. And now I can have `expire_on_commit` back too!
I never realized that `zope.sqlalchemy.mark_changed(` has it's own `keep_session` kwarg... which defaults to `False` and does not inherit from the existing configuration.
I can't tell why the errors on this was inconsistent. The app has a simplified "commit" hook that lets me handle multiple `pyramid_tm` commits in a single request, and I invoke mark_changed() in there to pick up a few edge cases. In a small number of these instances, I lost the `keep_session` setting - in others I didn't.