[WIP] Move restart logic from supervisor to agent