make options.generate a function that can provide finer-grained control over whether or not a new session should be created