I think also line 8 in sage.engine can cause the same problem. In my experience if line 8 is soutname=${filename/%tex/.sout}md5 doesn’t recognise created file.
So I put soutname=${filename/%tex/sagetex.sout} and it can tell if running Sage is necessary.