Set correct task status when starting a task

Added simple test that detects simple cyclic dependencies at
runtime.