In commit bf3a53f a workaround in the history method of adapters/active_record.rb was introduced that sorts the array outside of ActiveRecord when the transitions are already loaded. Otherwise a CollectionProxy would be returned, on which you can easily add more conditions and let the database do the work.
I was wondering if this workaround is actually required. I tested this with the first release release of Rails (v4.1.2) which contains said commit (rails/rails@b097ebe), and didn't encounter the infinite loop mentioned, nor did I using Rails v4.2.4.