diff --git a/codex-rs/hooks/src/user_notification.rs b/codex-rs/hooks/src/user_notification.rs index 801da59aef..caeca59b50 100644 --- a/codex-rs/hooks/src/user_notification.rs +++ b/codex-rs/hooks/src/user_notification.rs @@ -62,19 +62,14 @@ pub fn notify_hook(argv: Vec) -> Hook { command.arg(notify_payload); } - // Preserve the legacy argv + JSON payload shape, but wait for completion so - // after-agent hooks finish their side effects before the turn is marked done. + // Backwards-compat: match legacy notify behavior (argv + JSON arg, fire-and-forget). command .stdin(Stdio::null()) .stdout(Stdio::null()) .stderr(Stdio::null()); - match command.status().await { - Ok(status) if status.success() => HookResult::Success, - Ok(status) => HookResult::FailedContinue( - std::io::Error::other(format!("legacy notify exited with status {status}")) - .into(), - ), + match command.spawn() { + Ok(_) => HookResult::Success, Err(err) => HookResult::FailedContinue(err.into()), } })