diff --git a/hive-bash-mcp/src/runner.rs b/hive-bash-mcp/src/runner.rs index e1718c04..d7228012 100644 --- a/hive-bash-mcp/src/runner.rs +++ b/hive-bash-mcp/src/runner.rs @@ -88,10 +88,12 @@ pub(crate) fn suppress_wake(id: &str) { } /// Consume (remove + report) `id`'s suppression flag. Returns `true` if the -/// wake should be skipped. One-shot: a task id is only ever completed once, -/// so there's no risk of a stale suppression leaking onto a later task with -/// the same id (names are only reusable once the prior task has finished, -/// i.e. after this has already been consumed). +/// wake should be skipped. One-shot by intent: a completed task's entry is +/// meant to be drained exactly once. There's a known low-probability race +/// (see `run_task`'s completion handler) where `suppress_wake` for a task +/// fires *after* this has already run for it — if the same name gets reused +/// before that late insert lands, the dangling flag could suppress the new +/// task's wake instead. Not eliminated, just narrow. fn take_wake_suppressed(id: &str) -> bool { wake_suppressed().lock().unwrap().remove(id) }