session_id now stored as thread local var, not request env var.

This means the glue session id is available anywhere within the current thread vs only within a request context.  This is most helpful when generating routes outside of a controller or view, such as a presenter or helper class.  The particular issue occurred when including route helpers via "include Rails.application.routes.url_helpers" which does not have a handle to the current request env.

I personally do not see any reason not to use a Thread local variable.  I suppose the only danger might be that the glue session id persists across multiple requests, but this should never happen since the middleware will reset the session id or clear it if there is no glue session for the current request.