A deal has been reached in the bitter row over foreign workers being employed at an oil refinery, according to reports.