agent: Fix cancellation handling for scdaemon.