Honor session hooks
Add tests around hook behaviour
Fix failing test to preserve behaviour
Merge pull request #1657 from sigmavirus24/fix-session-hooks

Honor session hooks