This code:
def last_local_file_trigger
Dir.glob(File.join(local_directory, '*.trig')).last
end
does NOT get the last written file. It is basically nondeterministic and can choose pretty much any *.trig file in the directory.
The fix is to sort by time before doing .last; i'm committing this to my branch if you need this fix.