pub const GRACE_MS: u64 = 30_000;
A process tree counts once it has run this long: a command that is about to finish is not background work.