Bug #167149 has proven quite tricky to get right without regressing kraken/ai-astar by ~80%. I'm going to do the bare minimum in that patch (simply don't collect mustHandleValues when invalid), and leave a FIXME to go back and refactor the code while improving the heuristics and keeping mustHandleValues.